Skip to content

stylePreprocessorOptions not used for unit tests #4200

@psurrey

Description

@psurrey

Please provide us with the following information:

OS?

Mac OSX El Capitan

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.26
node: 6.9.1
os: darwin x64
@angular/common: 2.4.4
@angular/compiler: 2.4.4
@angular/core: 2.4.4
@angular/forms: 2.4.4
@angular/http: 2.4.4
@angular/platform-browser: 2.4.4
@angular/platform-browser-dynamic: 2.4.4
@angular/router: 3.4.4
@angular/compiler-cli: 2.4.4
@angular/tsc-wrapped: 0.5.1

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Make use of the recently added "stylePreprocessorOptions" in angular-cli.json in combination with stylus (#4003).

This is my config:

"stylePreprocessorOptions": {
        "includePaths": [
          "../node_modules/bootstrap-styl",
          "../node_modules/bootstrap-styl/stylus",
          "styles"
        ]
      },

In a *.component.styl stylus file I added @import('globals') which resolves to src/styles/globals.styl. With ng serve it works, but ng test fails.

The log given by the failure.

Error: Module build failed: Error: /Users/patrick/dev/leanix-pathfinder-web/src/app/app.component.styl:1:25
     1| @require('lib/constants')
  ------------------------------^
     2|
     3| .App
     4|   padding-top: 51px

  failed to locate @require file lib/constants.styl

      at CachedPathEvaluator.visitImport (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus-loader/lib/evaluator.js:157:21)
      at CachedPathEvaluator.Visitor.visit (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus/lib/visitor/index.js:28:40)
      at CachedPathEvaluator.Evaluator.visit (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus/lib/visitor/evaluator.js:160:18)
      at CachedPathEvaluator.Evaluator.visitRoot (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus/lib/visitor/evaluator.js:707:27)
      at CachedPathEvaluator.Visitor.visit (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus/lib/visitor/index.js:28:40)
      at CachedPathEvaluator.Evaluator.visit (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus/lib/visitor/evaluator.js:160:18)
      at CachedPathEvaluator.Evaluator.evaluate (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus/lib/visitor/evaluator.js:247:15)
      at Renderer.render (/Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus/lib/renderer.js:86:26)
      at /Users/patrick/dev/leanix-pathfinder-web/node_modules/stylus-loader/index.js:163:12
      at tryCatchReject (/Users/patrick/dev/leanix-pathfinder-web/node_modules/when/lib/makePromise.js:840:30)
      at runContinuation1 (/Users/patrick/dev/leanix-pathfinder-web/node_modules/when/lib/makePromise.js:799:4)
      at Fulfilled.when (/Users/patrick/dev/leanix-pathfinder-web/node_modules/when/lib/makePromise.js:590:4)
      at Pending.run (/Users/patrick/dev/leanix-pathfinder-web/node_modules/when/lib/makePromise.js:481:13)
      at Scheduler._drain (/Users/patrick/dev/leanix-pathfinder-web/node_modules/when/lib/Scheduler.js:62:19)
      at Scheduler.drain (/Users/patrick/dev/leanix-pathfinder-web/node_modules/when/lib/Scheduler.js:27:9)
      at _combinedTickCallback (internal/process/next_tick.js:67:7)
      at process._tickCallback (internal/process/next_tick.js:98:9)
  at src/test.ts:279131

Mention any other details that might be useful.

I have found that in models/webpack-build-test.js the stylus-load has no configuration as it does here: https://github.com/angular/angular-cli/pull/4003/files#diff-422be7f05c4af54ddd02152bfc358260R79

I think it should be added there as well!?


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions