Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adding new files w/ rollup shouldn't error #422

Merged
merged 3 commits into from
May 2, 2018
Merged

Conversation

tivac
Copy link
Owner

@tivac tivac commented May 1, 2018

Fixes #421 by making the result of Processor.remove() always an array instead of sometimes null.

@tivac tivac self-assigned this May 1, 2018
@TravisBuddy
Copy link

Travis tests have failed

Hey @tivac,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 6

npm test -- --coverage --verbose --ci
> modular-css-root@0.0.0 test /home/travis/build/tivac/modular-css
> jest "--coverage" "--verbose" "--ci"

PASS packages/core/test/options.test.js
  /processor.js
    options
      cwd
        ✓ should use an absolute path (715ms)
        ✓ should accept a relative path but make it absolute (4ms)
      namer
        ✓ should use a custom naming function (8ms)
        ✓ should require a namer if a string is passed (37ms)
        ✓ should use the default naming function if a non-function is passed (3ms)
      map
        ✓ should generate source maps (52ms)
        ○ skipped 1 test
      exportGlobals
        ✓ should not export :global values when exportGlobals is false (5ms)
      rewrite
        ✓ should rewrite url() references by default (7ms)
        ✓ should not rewrite url() references when falsey (3ms)
        ✓ should pass through to postcss-url as config (27ms)
      lifecycle options
        before
          ✓ should run sync postcss plugins before processing (4ms)
          ✓ should run async postcss plugins before processing (6ms)
        processing
          ✓ should run sync postcss plugins processing processing (2ms)
          ✓ should run async postcss plugins processing processing (4ms)
          ✓ should include exports from 'modular-css-export' modules (2ms)
        after
          ✓ should use postcss-url by default (4ms)
          ✓ should run sync postcss plugins (4ms)
          ✓ should run async postcss plugins (4ms)
        done
          ✓ should run sync postcss plugins done processing (3ms)
          ✓ should run async postcss plugins done processing (5ms)
          ✓ should work with cssnano (no preset) (1057ms)
          ��� should work with cssnano (default preset) (16ms)

PASS packages/rollup/test/rollup.test.js
  /rollup.js
    ✓ should be a function (7ms)
    ✓ should generate exports (84ms)
    ✓ should be able to tree-shake results (12ms)
    ✓ should attach a promise to the bundle.generate response (9ms)
    ✓ should generate CSS (19ms)
    ✓ should generate JSON (9ms)
    ✓ should provide named exports (9ms)
    ✓ should generate external source maps (7ms)
    ✓ should warn & not export individual keys when they are not valid identifiers (9ms)
    ✓ should allow disabling of named exports (7ms)
    ✓ shouldn't disable sourcemap generation (13ms)
    ✓ should not output sourcemaps when they are disabled (13ms)
    ✓ should respect the CSS dependency tree (17ms)
    errors
      ✓ should throw errors in in before plugins (5ms)
      ✓ should throw errors in after plugins (7ms)
      ○ skipped 1 test
    watch
      ✓ should generate correct builds in watch mode when files change (315ms)
      ✓ should correctly update files within the dependency graph in watch mode when files change (315ms)
      ✓ should correctly add new css files in watch mode when files change (314ms)

PASS packages/core/test/api.test.js
  /processor.js
    API
      ✓ should be a function (19ms)
      ✓ should auto-instantiate if called without new (1ms)
      .string()
        ✓ should process a string (9ms)
      .file()
        ✓ should process a relative file (5ms)
        ✓ should process an absolute file (3ms)
      .remove()
        ✓ should remove a relative file (2ms)
        ✓ should remove an absolute file (1ms)
        ✓ should remove multiple files (18ms)
        ✓ should remove dependant files (16ms)
        ✓ should return an array of removed files (3ms)
      .dependencies()
        ✓ should return the dependencies of the specified file (11ms)
        ✓ should return the overall order of dependencies if no file is specified (12ms)
      .output()
        ✓ should return a postcss result (15ms)
        ✓ should generate css representing the output from all added files (12ms)
        ✓ should avoid duplicating files in the output (11ms)
        ✓ should generate a JSON structure of all the compositions (12ms)
        ✓ should order output by dependencies, then alphabetically (21ms)
        ✓ should support returning output for specified relative files (21ms)
        ✓ should support returning output for specified absolute files (9ms)
        ✓ should reject if called before input has been processed (6ms)
        ✓ should allow for seperate source map output (21ms)
      ._resolve()
        ✓ should run resolvers until a match is found (2ms)
        ✓ should fall back to a default resolver (2ms)

(node:6125) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
PASS packages/webpack/test/webpack.test.js
  /webpack.js
    ✓ should be a function (3ms)
    ✓ should output css to disk (490ms)
    ✓ should output json to disk (54ms)
    ✓ should output inline source maps (33ms)
    ✓ should output external source maps to disk (43ms)
    ✓ should report errors (96ms)
    ✓ should report warnings on invalid property names (35ms)
    ✓ should handle dependencies (61ms)
    ✓ should support ES2015 default exports (31ms)
    ✓ should support ES2015 named exports (30ms)
    ✓ should support disabling namedExports when the option is set (38ms)
    ✓ should generate correct builds in watch mode when files change (460ms)
    ✓ should generate correct builds when files change (60ms)

PASS packages/browserify/test/factor-bundle.test.js
  /browserify.js
    factor-bundle
      ✓ should be supported (226ms)
      ✓ should support files w/o commonalities (62ms)
      ✓ should properly handle files w/o dependencies (78ms)
      ✓ should support relative paths within factor-bundle files (71ms)
      ✓ should avoid outputting empty css files by default (70ms)
      ✓ should output empty css files when asked (67ms)

PASS packages/browserify/test/browserify.test.js
  /browserify.js
    basic functionality
      ✓ should not error if no options are supplied (19ms)
      ✓ should error if an invalid extension is applied (14ms)
      ✓ should error on invalid CSS (19ms)
      ✓ should replace require() calls with the exported identifiers (42ms)
      ✓ should correctly rewrite urls based on the destination file (41ms)
      ✓ should use the specified namer function (44ms)
      ✓ should include all CSS dependencies in output css (52ms)
      ✓ should write out the complete exported identifiers when `json` is specified (37ms)
      ✓ should not include duplicate files in the output multiple times (51ms)
      ✓ should output an inline source map when the debug option is specified (57ms)
      ✓ should output an external source map when the debug option is specified (47ms)

PASS packages/core/test/composition.test.js
  /processor.js
    composition
      ✓ should fail on invalid composes syntax (20ms)
      ✓ should fail if a composition references a non-existant class (3ms)
      ✓ should fail if a composition references a non-existant file (2ms)
      ✓ should fail if composes isn't the first property (2ms)
      ✓ should fail on rules that use multiple selectors (3ms)
      ✓ should compose a single class (3ms)
      ✓ should allow comments before composes (4ms)
      ✓ should compose from globals (4ms)
      ✓ should compose multiple classes (4ms)
      ✓ should compose from other files (9ms)

PASS packages/browserify/test/watchify.test.js
  /browserify.js
    watchify
      ✓ shouldn't cache file contents between watchify runs (270ms)
      ✓ shouldn't explode on invalid CSS (170ms)

PASS packages/postcss/test/postcss.test.js
  /postcss.js
    ✓ should be a function (1ms)
    ✓ should process CSS and output the result (34ms)
    ✓ should process CSS with dependencies and output the result (22ms)
    ✓ should process CSS and output exports as a message (3ms)
    ✓ should accept normal processor options (9ms)
    ✓ should accept a `json` property and write exports to that file (16ms)
    ✓ should be usable like a normal postcss plugin (5ms)
    ✓ should output json when used within postcss (5ms)
    ✓ should accept json args in either position with postcss (4ms)

PASS packages/core/test/values.test.js
  /processor.js
    values
      ✓ should fail on invalid value syntax (16ms)
      ✓ should fail if a value imports a non-existant reference (2ms)
      ✓ should support simple values (4ms)
      ✓ should support local values in value composition (11ms)
      ✓ should support importing variables from a file (8ms)
      ✓ should support exporting imported variables (10ms)
      ✓ should support value composition (5ms)
      ✓ should support value namespaces (6ms)
      ✓ should support value replacement in :external(...) (23ms)

PASS packages/aliases/test/aliases.test.js
  modular-css-aliases
    ✓ should return a falsey value if a file isn't found (4ms)
    ✓ should return the absolute path if a file is found (1ms)
    ✓ should check multiple aliases for files & return the first match (2ms)
    ✓ should be usable as a modular-css resolver (32ms)
    ✓ should fall through to the default resolver (9ms)

PASS packages/core/test/scoping.test.js
  /processor.js
    scoping
      ✓ should scope classes, ids, and keyframes (23ms)
      ✓ should handle pseudo classes correctly (6ms)
      ✓ should not allow :global classes to overlap with local ones (local before global) (3ms)
      ✓ should not allow :global classes to overlap with local ones (global before local) (16ms)
      ✓ should not allow empty :global() selectors (2ms)

PASS packages/core/test/keyframes.test.js
  /processor.js
    scoping
      ✓ should leave unknown animation names alone (17ms)
      ✓ should update scoped animations from the scoping plugin's message (4ms)
      ✓ should update the animation-name property (4ms)
      ✓ should update multiple animations properly (3ms)
      ✓ should update scoped prefixed animations from the scoping plugin's message (2ms)

PASS packages/browserify/test/issue-313.test.js
  /browserify.js
    /issues
      /313
        ✓ should include all dependencies after watchify update (223ms)

PASS packages/browserify/test/issue-58.test.js
  /browserify.js
    /issues
      /58
        ✓ should update when CSS dependencies change (234ms)

FAIL packages/cli/test/cli.test.js
  /cli.js
    ✕ should show help with no args (90ms)
    ✕ should default to outputting to stdout (86ms)
    ✕ should support outputting to a file (--out) (78ms)
    ✕ should support outputting compositions to a file (--json) (90ms)
    ✕ should return the correct error code on invalid CSS (81ms)
    ✕ should support disabling url() rewriting (--no-rewrite) (79ms)

  ● /cli.js › should show help with no args

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should default to outputting to stdout

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting to a file (--out)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting compositions to a file (--json)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should return the correct error code on invalid CSS

    expect(received).toMatch(expected)
    
    Expected value to match:
      "Invalid composes reference"
    Received:
      "module.js:478
        throw err;
        ^
    
    Error: Cannot find module 'modular-css-glob'

       6 |     
       7 |     mkdirp = require("mkdirp"),
    >  8 |     glob = require("modular-css-glob"),
       9 |     cli = require("meow")(`
      10 |         Usage
      11 |         $ modular-css [options] <glob>...
      
      at Object.<anonymous> (packages/cli/cli.js:8:12)
      at Function.Module._load (module.js:445:3)"
      at tester.then.out (packages/cli/test/cli.test.js:62:32)

  ● /cli.js › should support disabling url() rewriting (--no-rewrite)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

PASS packages/svelte/test/svelte.test.js
  /svelte.js
    ✓ should generate exports (67ms)
    ✓ should ignore files without <style> blocks (5ms)
    ✓ should ignore invalid {css.<key>} (3ms)

PASS packages/paths/test/paths.test.js
  modular-css-paths
    ✓ should return a falsey value if a file isn't found (2ms)
    ✓ should return the absolute path if a file is found (1ms)
    ✓ should check multiple paths for files & return the first match
    ✓ should be usable as a modular-css resolver (29ms)

PASS packages/svelte/test/rollup.test.js
  /rollup.js
    ✓ should generate exports (260ms)
    ✓ should not generate exports (114ms)

PASS packages/core/test/externals.test.js
  /processor.js
    externals
      ✓ should fail if not a valid composition reference (18ms)
      ✓ should fail if not referencing another file (2ms)
      ✓ should fail on bad class references (7ms)
      ✓ should support overriding external values (22ms)

PASS packages/namer/test/index.test.js
  modular-css-namer
    ✓ should hash its arguments (2ms)
    ✓ should differ within files (1ms)
    ✓ should re-use selectors for identical inputs (1ms)
    ✓ should differ between files (1ms)
    ✓ should wrap as necessary (170ms)

PASS packages/glob/test/glob.test.js
  /glob.js
    ✓ should be a function (1ms)
    ✓ should use a default search (46ms)
    ✓ should find files on disk & output css (11ms)
    ✓ should support exclusion patterns (11ms)

PASS packages/core/test/exports.test.js
  /processor.js
    exports
      ✓ should export an object of arrays containing strings (24ms)
      ✓ should export identifiers and their classes (17ms)

PASS packages/core/test/getters.test.js
  /processor.js
    getters
      .file
        ✓ should return all the files that have been added (51ms)
      .options
        ✓ should return the merged options object (1ms)

PASS packages/core/test/issues/issue-56.test.js
  /issues
    /56
      ✓ should prune rules that only compose, but leave them in the exports (27ms)

PASS packages/core/test/issues/issue-24.test.js
  /issues
    /24
      ✓ should be able to compose using a value (45ms)

PASS packages/core/test/issues/issue-98.test.js
  /issues
    /98
      ✓ should prune rules that only compose, but leave them in the exports (18ms)

PASS packages/core/test/unicode.test.js
  /processor.js
    unicode
      ✓ should support unicode classes & ids (39ms)

PASS packages/core/test/issues/issue-66.test.js
  /issues
    /66
      ✓ should ignore remove calls for unknown files (18ms)

PASS packages/core/test/issues/issue-261.test.js
  /issues
    /261
      ✓ should allow colons in rules that also use :external() (24ms)

-----------------------|----------|----------|----------|----------|-------------------|
File                   |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------------------|----------|----------|----------|----------|-------------------|
All files              |    99.11 |       95 |    98.55 |    99.09 |                   |
 aliases               |      100 |      100 |      100 |      100 |                   |
  aliases.js           |      100 |      100 |      100 |      100 |                   |
 browserify            |    97.78 |    94.44 |    95.83 |    97.78 |                   |
  browserify.js        |    97.78 |    94.44 |    95.83 |    97.78 |            71,173 |
 browserify/test/lib   |      100 |      100 |      100 |      100 |                   |
  bundle.js            |      100 |      100 |      100 |      100 |                   |
 core                  |      100 |      100 |      100 |      100 |                   |
  processor.js         |      100 |      100 |      100 |      100 |                   |
 core/lib              |    98.53 |    91.67 |      100 |    98.48 |                   |
  graph-tiers.js       |    96.43 |    83.33 |      100 |     96.3 |                27 |
  identifiers.js       |      100 |      100 |      100 |      100 |                   |
  message.js           |      100 |      100 |      100 |      100 |                   |
  output.js            |      100 |      100 |      100 |      100 |                   |
  relative.js          |      100 |      100 |      100 |      100 |                   |
  resolve.js           |      100 |      100 |      100 |      100 |                   |
 core/plugins          |    99.65 |      100 |    98.57 |    99.65 |                   |
  composition.js       |      100 |      100 |      100 |      100 |                   |
  externals.js         |      100 |      100 |      100 |      100 |                   |
  graph-nodes.js       |      100 |      100 |      100 |      100 |                   |
  keyframes.js         |      100 |      100 |      100 |      100 |                   |
  scoping.js           |      100 |      100 |      100 |      100 |                   |
  values-composed.js   |      100 |      100 |      100 |      100 |                   |
  values-export.js     |    88.89 |      100 |       75 |    88.89 |                14 |
  values-imported.js   |      100 |      100 |      100 |      100 |                   |
  values-local.js      |      100 |      100 |      100 |      100 |                   |
  values-namespaced.js |      100 |      100 |      100 |      100 |                   |
  values-replace.js    |      100 |      100 |      100 |      100 |                   |
 glob                  |      100 |       50 |      100 |      100 |                   |
  glob.js              |      100 |       50 |      100 |      100 |                13 |
 namer                 |      100 |    83.33 |      100 |      100 |                   |
  index.js             |      100 |    83.33 |      100 |      100 |                42 |
 paths                 |      100 |      100 |      100 |      100 |                   |
  paths.js             |      100 |      100 |      100 |      100 |                   |
 postcss               |      100 |      100 |      100 |      100 |                   |
  postcss.js           |      100 |      100 |      100 |      100 |                   |
 rollup                |      100 |      100 |      100 |      100 |                   |
  rollup.js            |      100 |      100 |      100 |      100 |                   |
 svelte                |      100 |      100 |      100 |      100 |                   |
  methods.js           |      100 |      100 |      100 |      100 |                   |
  rollup.js            |      100 |      100 |      100 |      100 |                   |
  svelte.js            |      100 |      100 |      100 |      100 |                   |
 test-utils            |      100 |      100 |      100 |      100 |                   |
  namer.js             |      100 |      100 |      100 |      100 |                   |
  prefix.js            |      100 |      100 |      100 |      100 |                   |
  read.js              |      100 |      100 |      100 |      100 |                   |
  relative.js          |      100 |      100 |      100 |      100 |                   |
 webpack               |    95.08 |       75 |    92.86 |       95 |                   |
  loader.js            |    95.45 |    83.33 |      100 |    95.45 |                16 |
  plugin.js            |    94.87 |       70 |    90.91 |    94.74 |             14,25 |
-----------------------|----------|----------|----------|----------|-------------------|
Summary of all failing tests
FAIL packages/cli/test/cli.test.js
  ● /cli.js › should show help with no args

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should default to outputting to stdout

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting to a file (--out)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting compositions to a file (--json)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should return the correct error code on invalid CSS

    expect(received).toMatch(expected)
    
    Expected value to match:
      "Invalid composes reference"
    Received:
      "module.js:478
        throw err;
        ^
    
    Error: Cannot find module 'modular-css-glob'

       6 |     
       7 |     mkdirp = require("mkdirp"),
    >  8 |     glob = require("modular-css-glob"),
       9 |     cli = require("meow")(`
      10 |         Usage
      11 |         $ modular-css [options] <glob>...
      
      at Object.<anonymous> (packages/cli/cli.js:8:12)
      at Function.Module._load (module.js:445:3)"
      at tester.then.out (packages/cli/test/cli.test.js:62:32)

  ● /cli.js › should support disabling url() rewriting (--no-rewrite)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)


Test Suites: 1 failed, 2 skipped, 29 passed, 30 of 32 total
Tests:       6 failed, 5 skipped, 172 passed, 183 total
Snapshots:   192 passed, 192 total
Time:        18.974s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

@TravisBuddy
Copy link

Travis tests have failed

Hey @tivac,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 6

npm test -- --coverage --verbose --ci
> modular-css-root@0.0.0 test /home/travis/build/tivac/modular-css
> jest "--coverage" "--verbose" "--ci"

PASS packages/core/test/options.test.js
  /processor.js
    options
      cwd
        ✓ should use an absolute path (724ms)
        ✓ should accept a relative path but make it absolute (3ms)
      namer
        ✓ should use a custom naming function (10ms)
        ✓ should require a namer if a string is passed (41ms)
        ✓ should use the default naming function if a non-function is passed (2ms)
      map
        ✓ should generate source maps (46ms)
        ○ skipped 1 test
      exportGlobals
        ✓ should not export :global values when exportGlobals is false (6ms)
      rewrite
        ✓ should rewrite url() references by default (7ms)
        ✓ should not rewrite url() references when falsey (3ms)
        ✓ should pass through to postcss-url as config (22ms)
      lifecycle options
        before
          ✓ should run sync postcss plugins before processing (3ms)
          ✓ should run async postcss plugins before processing (5ms)
        processing
          ✓ should run sync postcss plugins processing processing (2ms)
          ✓ should run async postcss plugins processing processing (3ms)
          ✓ should include exports from 'modular-css-export' modules (1ms)
        after
          ✓ should use postcss-url by default (3ms)
          ✓ should run sync postcss plugins (3ms)
          ✓ should run async postcss plugins (3ms)
        done
          ✓ should run sync postcss plugins done processing (4ms)
          ✓ should run async postcss plugins done processing (5ms)
          ✓ should work with cssnano (no preset) (1021ms)
          ��� should work with cssnano (default preset) (15ms)

PASS packages/rollup/test/rollup.test.js
  /rollup.js
    ✓ should be a function (6ms)
    ✓ should generate exports (78ms)
    ✓ should be able to tree-shake results (14ms)
    ✓ should attach a promise to the bundle.generate response (14ms)
    ✓ should generate CSS (21ms)
    ✓ should generate JSON (12ms)
    ✓ should provide named exports (9ms)
    ✓ should generate external source maps (8ms)
    ✓ should warn & not export individual keys when they are not valid identifiers (10ms)
    ✓ should allow disabling of named exports (8ms)
    ✓ shouldn't disable sourcemap generation (12ms)
    ✓ should not output sourcemaps when they are disabled (14ms)
    ✓ should respect the CSS dependency tree (15ms)
    errors
      ✓ should throw errors in in before plugins (5ms)
      ✓ should throw errors in after plugins (5ms)
      ○ skipped 1 test
    watch
      ✓ should generate correct builds in watch mode when files change (407ms)
      ✓ should correctly update files within the dependency graph in watch mode when files change (316ms)
      ✓ should correctly add new css files in watch mode when files change (313ms)

PASS packages/core/test/api.test.js
  /processor.js
    API
      ✓ should be a function (18ms)
      ✓ should auto-instantiate if called without new (3ms)
      .string()
        ✓ should process a string (8ms)
      .file()
        ✓ should process a relative file (6ms)
        ✓ should process an absolute file (4ms)
      .remove()
        ✓ should remove a relative file (2ms)
        ✓ should remove an absolute file (2ms)
        ✓ should remove multiple files (17ms)
        ✓ should remove dependant files (17ms)
        ✓ should return an array of removed files (4ms)
      .dependencies()
        ✓ should return the dependencies of the specified file (14ms)
        ✓ should return the overall order of dependencies if no file is specified (10ms)
      .output()
        ✓ should return a postcss result (15ms)
        ✓ should generate css representing the output from all added files (13ms)
        ✓ should avoid duplicating files in the output (12ms)
        ✓ should generate a JSON structure of all the compositions (13ms)
        ✓ should order output by dependencies, then alphabetically (23ms)
        ✓ should support returning output for specified relative files (21ms)
        ✓ should support returning output for specified absolute files (10ms)
        ✓ should reject if called before input has been processed (6ms)
        ✓ should allow for seperate source map output (23ms)
      ._resolve()
        ✓ should run resolvers until a match is found (2ms)
        ✓ should fall back to a default resolver (2ms)

(node:6051) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
PASS packages/webpack/test/webpack.test.js
  /webpack.js
    ✓ should be a function (4ms)
    ✓ should output css to disk (528ms)
    ✓ should output json to disk (52ms)
    ✓ should output inline source maps (35ms)
    ✓ should output external source maps to disk (44ms)
    ✓ should report errors (92ms)
    ✓ should report warnings on invalid property names (37ms)
    ✓ should handle dependencies (59ms)
    ✓ should support ES2015 default exports (26ms)
    ✓ should support ES2015 named exports (26ms)
    ✓ should support disabling namedExports when the option is set (35ms)
    ✓ should generate correct builds in watch mode when files change (446ms)
    ✓ should generate correct builds when files change (72ms)

PASS packages/browserify/test/factor-bundle.test.js
  /browserify.js
    factor-bundle
      ✓ should be supported (260ms)
      ✓ should support files w/o commonalities (64ms)
      ✓ should properly handle files w/o dependencies (83ms)
      ✓ should support relative paths within factor-bundle files (75ms)
      ✓ should avoid outputting empty css files by default (76ms)
      ✓ should output empty css files when asked (72ms)

PASS packages/browserify/test/browserify.test.js
  /browserify.js
    basic functionality
      ✓ should not error if no options are supplied (22ms)
      ✓ should error if an invalid extension is applied (3ms)
      ✓ should error on invalid CSS (37ms)
      ✓ should replace require() calls with the exported identifiers (43ms)
      ✓ should correctly rewrite urls based on the destination file (40ms)
      ✓ should use the specified namer function (46ms)
      ✓ should include all CSS dependencies in output css (62ms)
      ✓ should write out the complete exported identifiers when `json` is specified (43ms)
      ✓ should not include duplicate files in the output multiple times (53ms)
      ✓ should output an inline source map when the debug option is specified (58ms)
      ✓ should output an external source map when the debug option is specified (50ms)

PASS packages/core/test/composition.test.js
  /processor.js
    composition
      ✓ should fail on invalid composes syntax (17ms)
      ✓ should fail if a composition references a non-existant class (4ms)
      ✓ should fail if a composition references a non-existant file (2ms)
      ✓ should fail if composes isn't the first property (2ms)
      ✓ should fail on rules that use multiple selectors (4ms)
      ✓ should compose a single class (4ms)
      ✓ should allow comments before composes (3ms)
      ✓ should compose from globals (5ms)
      ✓ should compose multiple classes (4ms)
      ✓ should compose from other files (8ms)

PASS packages/browserify/test/watchify.test.js
  /browserify.js
    watchify
      ✓ shouldn't cache file contents between watchify runs (261ms)
      ✓ shouldn't explode on invalid CSS (170ms)

PASS packages/postcss/test/postcss.test.js
  /postcss.js
    ✓ should be a function (2ms)
    ✓ should process CSS and output the result (25ms)
    ✓ should process CSS with dependencies and output the result (19ms)
    ✓ should process CSS and output exports as a message (4ms)
    ✓ should accept normal processor options (8ms)
    ✓ should accept a `json` property and write exports to that file (15ms)
    ✓ should be usable like a normal postcss plugin (6ms)
    ✓ should output json when used within postcss (4ms)
    ✓ should accept json args in either position with postcss (3ms)

PASS packages/core/test/values.test.js
  /processor.js
    values
      ✓ should fail on invalid value syntax (19ms)
      ✓ should fail if a value imports a non-existant reference (3ms)
      ✓ should support simple values (5ms)
      ✓ should support local values in value composition (12ms)
      ✓ should support importing variables from a file (11ms)
      ✓ should support exporting imported variables (11ms)
      ✓ should support value composition (7ms)
      ✓ should support value namespaces (7ms)
      ✓ should support value replacement in :external(...) (25ms)

PASS packages/aliases/test/aliases.test.js
  modular-css-aliases
    ✓ should return a falsey value if a file isn't found (2ms)
    ✓ should return the absolute path if a file is found (1ms)
    ✓ should check multiple aliases for files & return the first match (1ms)
    ✓ should be usable as a modular-css resolver (26ms)
    ✓ should fall through to the default resolver (10ms)

PASS packages/core/test/scoping.test.js
  /processor.js
    scoping
      ✓ should scope classes, ids, and keyframes (20ms)
      ✓ should handle pseudo classes correctly (5ms)
      ✓ should not allow :global classes to overlap with local ones (local before global) (3ms)
      ✓ should not allow :global classes to overlap with local ones (global before local) (2ms)
      ✓ should not allow empty :global() selectors (15ms)

PASS packages/core/test/keyframes.test.js
  /processor.js
    scoping
      ✓ should leave unknown animation names alone (23ms)
      ✓ should update scoped animations from the scoping plugin's message (4ms)
      ✓ should update the animation-name property (4ms)
      ✓ should update multiple animations properly (4ms)
      ✓ should update scoped prefixed animations from the scoping plugin's message (3ms)

PASS packages/browserify/test/issue-313.test.js
  /browserify.js
    /issues
      /313
        ✓ should include all dependencies after watchify update (245ms)

PASS packages/browserify/test/issue-58.test.js
  /browserify.js
    /issues
      /58
        ✓ should update when CSS dependencies change (253ms)

FAIL packages/cli/test/cli.test.js
  /cli.js
    ✕ should show help with no args (106ms)
    ✕ should default to outputting to stdout (93ms)
    ✕ should support outputting to a file (--out) (88ms)
    ✕ should support outputting compositions to a file (--json) (88ms)
    ✕ should return the correct error code on invalid CSS (90ms)
    ✕ should support disabling url() rewriting (--no-rewrite) (96ms)

  ● /cli.js › should show help with no args

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should default to outputting to stdout

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting to a file (--out)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting compositions to a file (--json)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should return the correct error code on invalid CSS

    expect(received).toMatch(expected)
    
    Expected value to match:
      "Invalid composes reference"
    Received:
      "module.js:478
        throw err;
        ^
    
    Error: Cannot find module 'modular-css-glob'

       6 |     
       7 |     mkdirp = require("mkdirp"),
    >  8 |     glob = require("modular-css-glob"),
       9 |     cli = require("meow")(`
      10 |         Usage
      11 |         $ modular-css [options] <glob>...
      
      at Object.<anonymous> (packages/cli/cli.js:8:12)
      at Function.Module._load (module.js:445:3)"
      at tester.then.out (packages/cli/test/cli.test.js:62:32)

  ● /cli.js › should support disabling url() rewriting (--no-rewrite)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

PASS packages/svelte/test/svelte.test.js
  /svelte.js
    ✓ should generate exports (75ms)
    ✓ should ignore files without <style> blocks (5ms)
    ✓ should ignore invalid {css.<key>} (4ms)

PASS packages/paths/test/paths.test.js
  modular-css-paths
    ✓ should return a falsey value if a file isn't found (2ms)
    ✓ should return the absolute path if a file is found (1ms)
    ✓ should check multiple paths for files & return the first match (1ms)
    ✓ should be usable as a modular-css resolver (30ms)

PASS packages/svelte/test/rollup.test.js
  /rollup.js
    ✓ should generate exports (257ms)
    ✓ should not generate exports (119ms)

PASS packages/core/test/externals.test.js
  /processor.js
    externals
      ✓ should fail if not a valid composition reference (19ms)
      ✓ should fail if not referencing another file (2ms)
      ✓ should fail on bad class references (7ms)
      ✓ should support overriding external values (29ms)

PASS packages/namer/test/index.test.js
  modular-css-namer
    ✓ should hash its arguments (2ms)
    ✓ should differ within files (1ms)
    ✓ should re-use selectors for identical inputs
    ✓ should differ between files (2ms)
    ✓ should wrap as necessary (152ms)

PASS packages/glob/test/glob.test.js
  /glob.js
    ✓ should be a function (2ms)
    ✓ should use a default search (50ms)
    ✓ should find files on disk & output css (12ms)
    ✓ should support exclusion patterns (10ms)

PASS packages/core/test/exports.test.js
  /processor.js
    exports
      ✓ should export an object of arrays containing strings (20ms)
      ✓ should export identifiers and their classes (15ms)

PASS packages/core/test/getters.test.js
  /processor.js
    getters
      .file
        ✓ should return all the files that have been added (45ms)
      .options
        ✓ should return the merged options object

PASS packages/core/test/issues/issue-56.test.js
  /issues
    /56
      ✓ should prune rules that only compose, but leave them in the exports (20ms)

PASS packages/core/test/issues/issue-24.test.js
  /issues
    /24
      ✓ should be able to compose using a value (53ms)

PASS packages/core/test/issues/issue-98.test.js
  /issues
    /98
      ✓ should prune rules that only compose, but leave them in the exports (24ms)

PASS packages/core/test/unicode.test.js
  /processor.js
    unicode
      ✓ should support unicode classes & ids (57ms)

PASS packages/core/test/issues/issue-66.test.js
  /issues
    /66
      ✓ should ignore remove calls for unknown files (17ms)

PASS packages/core/test/issues/issue-261.test.js
  /issues
    /261
      ✓ should allow colons in rules that also use :external() (26ms)

-----------------------|----------|----------|----------|----------|-------------------|
File                   |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------------------|----------|----------|----------|----------|-------------------|
All files              |    99.11 |       95 |    98.55 |    99.09 |                   |
 aliases               |      100 |      100 |      100 |      100 |                   |
  aliases.js           |      100 |      100 |      100 |      100 |                   |
 browserify            |    97.78 |    94.44 |    95.83 |    97.78 |                   |
  browserify.js        |    97.78 |    94.44 |    95.83 |    97.78 |            71,173 |
 browserify/test/lib   |      100 |      100 |      100 |      100 |                   |
  bundle.js            |      100 |      100 |      100 |      100 |                   |
 core                  |      100 |      100 |      100 |      100 |                   |
  processor.js         |      100 |      100 |      100 |      100 |                   |
 core/lib              |    98.53 |    91.67 |      100 |    98.48 |                   |
  graph-tiers.js       |    96.43 |    83.33 |      100 |     96.3 |                27 |
  identifiers.js       |      100 |      100 |      100 |      100 |                   |
  message.js           |      100 |      100 |      100 |      100 |                   |
  output.js            |      100 |      100 |      100 |      100 |                   |
  relative.js          |      100 |      100 |      100 |      100 |                   |
  resolve.js           |      100 |      100 |      100 |      100 |                   |
 core/plugins          |    99.65 |      100 |    98.57 |    99.65 |                   |
  composition.js       |      100 |      100 |      100 |      100 |                   |
  externals.js         |      100 |      100 |      100 |      100 |                   |
  graph-nodes.js       |      100 |      100 |      100 |      100 |                   |
  keyframes.js         |      100 |      100 |      100 |      100 |                   |
  scoping.js           |      100 |      100 |      100 |      100 |                   |
  values-composed.js   |      100 |      100 |      100 |      100 |                   |
  values-export.js     |    88.89 |      100 |       75 |    88.89 |                14 |
  values-imported.js   |      100 |      100 |      100 |      100 |                   |
  values-local.js      |      100 |      100 |      100 |      100 |                   |
  values-namespaced.js |      100 |      100 |      100 |      100 |                   |
  values-replace.js    |      100 |      100 |      100 |      100 |                   |
 glob                  |      100 |       50 |      100 |      100 |                   |
  glob.js              |      100 |       50 |      100 |      100 |                13 |
 namer                 |      100 |    83.33 |      100 |      100 |                   |
  index.js             |      100 |    83.33 |      100 |      100 |                42 |
 paths                 |      100 |      100 |      100 |      100 |                   |
  paths.js             |      100 |      100 |      100 |      100 |                   |
 postcss               |      100 |      100 |      100 |      100 |                   |
  postcss.js           |      100 |      100 |      100 |      100 |                   |
 rollup                |      100 |      100 |      100 |      100 |                   |
  rollup.js            |      100 |      100 |      100 |      100 |                   |
 svelte                |      100 |      100 |      100 |      100 |                   |
  methods.js           |      100 |      100 |      100 |      100 |                   |
  rollup.js            |      100 |      100 |      100 |      100 |                   |
  svelte.js            |      100 |      100 |      100 |      100 |                   |
 test-utils            |      100 |      100 |      100 |      100 |                   |
  namer.js             |      100 |      100 |      100 |      100 |                   |
  prefix.js            |      100 |      100 |      100 |      100 |                   |
  read.js              |      100 |      100 |      100 |      100 |                   |
  relative.js          |      100 |      100 |      100 |      100 |                   |
 webpack               |    95.08 |       75 |    92.86 |       95 |                   |
  loader.js            |    95.45 |    83.33 |      100 |    95.45 |                16 |
  plugin.js            |    94.87 |       70 |    90.91 |    94.74 |             14,25 |
-----------------------|----------|----------|----------|----------|-------------------|
Summary of all failing tests
FAIL packages/cli/test/cli.test.js
  ● /cli.js › should show help with no args

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should default to outputting to stdout

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting to a file (--out)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should support outputting compositions to a file (--json)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)

  ● /cli.js › should return the correct error code on invalid CSS

    expect(received).toMatch(expected)
    
    Expected value to match:
      "Invalid composes reference"
    Received:
      "module.js:478
        throw err;
        ^
    
    Error: Cannot find module 'modular-css-glob'

       6 |     
       7 |     mkdirp = require("mkdirp"),
    >  8 |     glob = require("modular-css-glob"),
       9 |     cli = require("meow")(`
      10 |         Usage
      11 |         $ modular-css [options] <glob>...
      
      at Object.<anonymous> (packages/cli/cli.js:8:12)
      at Function.Module._load (module.js:445:3)"
      at tester.then.out (packages/cli/test/cli.test.js:62:32)

  ● /cli.js › should support disabling url() rewriting (--no-rewrite)

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      0
    Received:
      1

       8 | 
       9 | function success(out) {
    > 10 |     expect(out.code).toBe(0);
      11 |     
      12 |     return out;
      13 | }
      
      at success (packages/cli/test/cli.test.js:10:22)


Test Suites: 1 failed, 2 skipped, 29 passed, 30 of 32 total
Tests:       6 failed, 5 skipped, 172 passed, 183 total
Snapshots:   192 passed, 192 total
Time:        19.278s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

@TravisBuddy
Copy link

Hey @tivac,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because something unrelated to the tests, like a problem a dependency or the build process itself.

@tivac tivac merged commit 87beb93 into master May 2, 2018
@tivac tivac deleted the rollup-new-file branch May 2, 2018 05:19
tivac added a commit that referenced this pull request May 2, 2018
tivac added a commit that referenced this pull request May 2, 2018
Fixes #421

BREAKING CHANGE: Processor.remove now always returns an array. If
nothing was removed the array will be empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants