ncc: Failing tests with ncc 0.20.1
The now-builders repo has 4 failing test fixtures and most of them appear to be regressions in ncc.
Update: Tracking issues -
Steps to reproduce
Please clone the repo and install dependencies:
git clone https://github.com/zeit/now-builders
cd now-builders
yarn
yarn bootstrap
yarn build
I went through each fixture and some fail differently with the CLI vs API.
- CLI: this means I ran the commands you see below
- API: this means programatic usage from @now/node index.ts
08-assets
cd packages/now-node/test/fixtures/08-assets
echo 'require("http").createServer(module.exports).listen(3000)' >> index.js
npx @zeit/ncc@0.20.1 build index.js --source-map
node dist
- Works from CLI
- Fails from API. Probably incorrect
assetspaths.
09-include-files
cd packages/now-node/test/fixtures/09-include-files
npm install
echo 'require("http").createServer(module.exports).listen(3000)' >> root.js
npx @zeit/ncc@0.20.1 build root.js --source-map
node dist
- Fails from CLI with “RuntimeException: E_MISSING_VIEW: Cannot render root.edge. Make sure the file exists at”
- Fails from API. This could probably be resolved by
globinstead of emittingassetsso hold off on changing this one for now.
14-stack-trace-ts
cd packages/now-node/test/fixtures/14-stack-trace-ts
echo 'require("http").createServer(handler).listen(3000)' >> index.ts
npx @zeit/ncc@0.20.1 build index.ts --source-map
node dist
- Works from CLI
- Fails from API with “callback was already called” 🤔
15-helpers
cd packages/now-node/test/fixtures/15-helpers/ts
echo 'require("http").createServer(listener).listen(3000)' >> index.ts
npx @zeit/ncc@0.20.1 build index.ts --source-map
node dist
- Fails from CLI with “TypeError: res.status is not a function”
- Fails from API with “callback was already called” 🤔
I think the TypeError can be ignored and probably fixing test 14 will fix 15.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (13 by maintainers)
Commits related to this issue
- upgrades to ncc@0.20.2 this includes the fixes for https://github.com/zeit/ncc/issues/434 — committed to ywg-jean/now-builders by jeantil 5 years ago
- upgrades to ncc@0.20.2 this includes the fixes for https://github.com/zeit/ncc/issues/434 — committed to ywg-jean/now-builders by jeantil 5 years ago
These are all fixed now in the latest ncc. Will continue to track the TypeScript workaround in https://github.com/zeit/ncc/issues/435.
Weird, as that should be identical to the 0.18 behaviour… sure I will take a look first thing Monday.
hello @guybedford
I have updated my PR against now-builders to upgrade to ncc@0.20.2 unfortunately the tests are still failing: https://circleci.com/gh/zeit/now-builders/2662
08-assets
You comment suggests that the tests for assets (8 in both now-node and now-server) need to configure
filterAssetBaseto work properly. Being unsure what the value for the option should be. I have tried both of the values that looked like path in the scope where ncc (entrypointPath and workPath) is called but neither resulted in a green test and I am way out of my depth there. revisiting everything I think I should passpath.resolve('workpath')but I get[Error: Rate limit exceeded]when I try to run the tests now 😦 edit : after waiting for the limits to reset,path.resolve('workpath')fixed test 08.09-include-files
In my understanding upgrading to
ncc@0.20.2won’t help. I will try to rephrase the issue as I understand it, ncc doesn’t know that it should package the templates directory. Between 0.18.x and 0.20.x ncc started filtering paths more aggressively, and dynamically constructed paths can now be filtered out. you advised changing the test but I am unsure I understand how it should be changed … should it usepath.join(__dirname ,...)as documented on https://edge.adonisjs.com/ and used in 08-assets or should it provide a different way to resolve the proper template path ? edit : after waiting for the limits to reset usingpath.join(__dirname,'./templates')doesn’t seem to be enough to fix this test.14-stack-trace-ts
fails to build with the following error :
full trace :
15-helpers
fails with
Thanks @styfle - 14,15 seems like another builtin TypeScript bug and I believe I know the issue. Will aim to post a patch in the next few days. The workaround can be to copy the dist/ncc/loaders/ts-loader.js file in the ncc 18 build over the 0.20 build and publish that as this file is the same bit just an internal build issue.
On Wed, 26 Jun 2019 at 18:44, Steven notifications@github.com wrote:
All of the ncc issues here have been resolved in 0.20.2.
14 and 15 should be fixed on the upgrade by default. If not, we can reinvestigate.
The now-node issues to do with over-filtering can be caught by providing the
debugLogoption to ncc to see logs like the above.The filtering fix for 08 is to set
filterAssetBase: path.resolve('/pkg/path')so that it doesn’t use theprocess.cwd()filter base by default and instead knows that these root-level paths are ok/tmp/sdfor something I believe the path was.We finally traced down 08 to the following filtering issue by building with
debugLog: true:Created https://github.com/zeit/ncc/issues/440.
I managed to trace 14 and 15 down to https://github.com/zeit/ncc/issues/435.