tj / node-prune

Remove unnecessary files from node_modules (.md, .ts, ...)
MIT License
4.4k stars 130 forks source link

necessary file rails-ujs/lib/assets/compiled/rails-ujs.js deleted #61

Open caleb15 opened 5 years ago

caleb15 commented 5 years ago

When I added node-prune one of our tests started failing:

yarn run v1.13.0
$ jest --collectCoverage --ci --runInBand --reporters=default --reporters=jest-junit
 PASS  js/modules/objectives/dashboard/__tests__/_create-test.js
 PASS  js/modules/core/__tests__/react_select-test.js
 FAIL  js/__tests__/vendor-test.js
  ● rails-ujs should be defined as a browser global

    ENOENT: no such file or directory, open '/home/circleci/project/ff/static/node_modules/rails-ujs/lib/assets/compiled/rails-ujs.js'

      31 | 
      32 | function runScriptInContext(...paths) {
    > 33 |   const data = fs.readFileSync(path.resolve(...paths));
         |                   ^
      34 |   const script = new vm.Script(data);
      35 | 
      36 |   const context = vm.createContext(sandbox);

      at readFileSync (js/__tests__/vendor-test.js:33:19)
      at Object.runScriptInContext (js/__tests__/vendor-test.js:258:21)

relevant section of our circleci config:

      - run: 
          name: Install node-prune
          command: curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash

      - run: ./bin/node-prune node_modules
      - run: ./bin/node-prune ff/static/node_modules