michalkvasnicak / babel-plugin-css-modules-transform

Extract css class names from required css module files, so we can render it on server.
MIT License
326 stars 54 forks source link

Some local test cases fail #84

Open xile611 opened 6 years ago

xile611 commented 6 years ago

@michalkvasnicak I want to submit a PR which support to change the path of css file when keepImport is true. But some local test cases fail which don't have any relation to my changes. Can you have a look at?

    1) should write a multiple css files using import
    2) should write a multiple css files using import preserving directory structure
    3) should write a multiple css files using require
    4) should write a single css file using import
    5) should write a single css file using require
    6) should extract styles with a single input file via gulp
    7) should extract multiple files via gulp
    8) should extract combined files via gulp
    9) should call custom preprocess
  1) babel-plugin-css-modules-transform should write a multiple css files using import:
     Error: ENOENT: no such file or directory, open '/Users/ling/Documents/gitwork/babel-plugin-css-modules-transform/test/output/parent.css'
      at Object.fs.openSync (fs.js:584:18)
      at fs.readFileSync (fs.js:491:33)
      at readExpected (test/index.spec.js:52:16)
      at Context.it (test/index.spec.js:121:16)
      at next (node_modules/rimraf/rimraf.js:75:7)
      at CB (node_modules/rimraf/rimraf.js:111:9)
      at node_modules/rimraf/rimraf.js:137:14
      at FSReqWrap.oncomplete (fs.js:114:15)

  2) babel-plugin-css-modules-transform should write a multiple css files using import preserving directory structure:
     Error: ENOENT: no such file or directory, open '/Users/ling/Documents/gitwork/babel-plugin-css-modules-transform/test/output/parent.css'
      at Object.fs.openSync (fs.js:584:18)
      at fs.readFileSync (fs.js:491:33)
      at readExpected (test/index.spec.js:52:16)
      at Context.it (test/index.spec.js:136:16)
      at next (node_modules/rimraf/rimraf.js:75:7)
      at FSReqWrap.CB [as oncomplete] (node_modules/rimraf/rimraf.js:111:9)

  3) babel-plugin-css-modules-transform should write a multiple css files using require:
     Error: ENOENT: no such file or directory, open '/Users/ling/Documents/gitwork/babel-plugin-css-modules-transform/test/output/parent.css'
      at Object.fs.openSync (fs.js:584:18)
      at fs.readFileSync (fs.js:491:33)
      at readExpected (test/index.spec.js:52:16)
      at Context.it (test/index.spec.js:153:16)
      at next (node_modules/rimraf/rimraf.js:75:7)
      at FSReqWrap.CB [as oncomplete] (node_modules/rimraf/rimraf.js:111:9)

  4) babel-plugin-css-modules-transform should write a single css file using import:

      AssertionError: expected '/*  imported from css/child.css  */\n\n.child__line___3fweh {\n    display: inline;\n}\n\n/*  imported from parent.css  */\n\n.parent__block___33Sxl {\n    display: block;\n}\n\n/*  imported from styles.css  */\n\n.styles__className___385m0 {\n    color: red;\n}' to equal '.child__line___3fweh {\n    display: inline;\n}\n.parent__block___33Sxl {\n    display: block;\n}\n.styles__className___385m0 {\n    color: red;\n}'
      + expected - actual

      -/*  imported from css/child.css  */
      -
       .child__line___3fweh {
           display: inline;
       }
      -
      -/*  imported from parent.css  */
      -
       .parent__block___33Sxl {
           display: block;
       }
      -
      -/*  imported from styles.css  */
      -
       .styles__className___385m0 {
           color: red;
       }

      at Context.it (test/index.spec.js:165:20)
      at next (node_modules/rimraf/rimraf.js:75:7)
      at FSReqWrap.CB [as oncomplete] (node_modules/rimraf/rimraf.js:111:9)