From f929fb1f1a8e6c50c25ab30305edabcd482c434f Mon Sep 17 00:00:00 2001 From: Gasan <465806+gusega@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:43:37 +0100 Subject: [PATCH] Update 02-build-system.md 1. replace intellij with Intellij 2. update config file location Signed-off-by: Gasan <465806+gusega@users.noreply.github.com> --- docs/tooling/cli/02-build-system.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tooling/cli/02-build-system.md b/docs/tooling/cli/02-build-system.md index f2a6974b86..38a76eacd4 100644 --- a/docs/tooling/cli/02-build-system.md +++ b/docs/tooling/cli/02-build-system.md @@ -600,10 +600,10 @@ For your productivity working with unit tests it's quite essential to have your At the moment it's not possible to run jest tests via jest command line. That is, if you run the following command from the project root: ```bash -NODE_OPTIONS='--no-node-snapshot --experimental-vm-modules' node node_modules/jest-cli/bin/jest.js --config packages/cli/config/jest.js +NODE_OPTIONS='--no-node-snapshot --experimental-vm-modules' node node_modules/jest-cli/bin/jest.js --config node_modules/@backstage/cli/config/jest.js ``` -You will get an error `Unexpected token 'export'` complaining about one of the imports from the `jest.js` config file. But why does jest work then when running `backstage-cli repo test`? +You will get an error `SyntaxError: Unexpected token 'export'` complaining about one of the imports from the `jest.js` config file. But why does jest work then when running `backstage-cli repo test`? The reason is that `packages/cli/bin/backstage-cli` first executes `require('@backstage/cli/config/nodeTransform.cjs');` that probably transforms config files so that jest can use them. Even simply adding `require('@backstage/cli/config/nodeTransform.cjs');` to the beginning of `node_modules/jest/bin/jest.js`, will make jest command line above work. @@ -614,7 +614,7 @@ NODE_OPTIONS='--no-node-snapshot --experimental-vm-modules' node node_modules/@b `backstage-cli` adds `--passWithNoTests --watch --workerIdleMemoryLimit=1000M --config node_modules/@backstage/cli/config/jest.js` jest options. -So, to run it in intellij do the following: +So, to run it in Intellij do the following: 1. Update Jest configuration template by: 1. Click on "Edit Configurations" on top panel @@ -626,7 +626,7 @@ So, to run it in intellij do the following: 7. "Jest Options": `repo test --runInBand` 8. "Environment variables": `backstage-cli` adds `--watch` jest option, so if you want your tests to stop after you run them, add `CI=true` -2. Another issue is that if you right click on the test, intellij will create a playwright configuration, see [WEB-67720](https://youtrack.jetbrains.com/issue/WEB-67720/Jest-test-runs-as-playwright-test). So, to run jest tests create a configuration manually, the intellij will pick up the configuration template, provide there the test file. After intellij run tests in the file you can click on the individual tests in the run panel and re-run them, intellij will create a correct jest run configuration. +2. Another issue is that if you right click on the test, Intellij will create a playwright configuration, see [WEB-67720](https://youtrack.jetbrains.com/issue/WEB-67720/Jest-test-runs-as-playwright-test). So, to run jest tests create a configuration manually, the Intellij will pick up the configuration template, provide there the test file. After Intellij run tests in the file you can click on the individual tests in the run panel and re-run them, Intellij will create a correct jest run configuration. #### VS Code