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

chore: Fix coverage test #14802

Merged
merged 2 commits into from Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Expand Up @@ -210,8 +210,7 @@ $ OVERWRITE=true TEST_ONLY=babel-plugin-transform-classes make test-only
To test the code coverage, use:

```sh
$ BABEL_ENV=cov make build
$ ./scripts/test-cov.sh
make test-cov
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually broken because BABEL_COVERAGE=true is not set.

```

#### Troubleshooting Tests
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Expand Up @@ -81,6 +81,9 @@ fix-json:
clean:
$(MAKEJS) clean

test-cov:
$(MAKEJS) test-cov

test: lint test-only

clone-license:
Expand Down Expand Up @@ -137,14 +140,12 @@ update-env-corejs-fixture:
OVERWRITE=true $(YARN) jest packages/babel-preset-env

test-ci: build-standalone-ci
BABEL_ENV=test $(YARN) jest --maxWorkers=4 --ci
BABEL_ENV=test $(YARN) jest --maxWorkers=100% --ci
$(MAKE) test-clean

# Does not work on Windows
test-ci-coverage: SHELL:=/bin/bash
test-ci-coverage:
BABEL_COVERAGE=true BABEL_ENV=test $(MAKE) bootstrap
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
BABEL_ENV=test BABEL_COVERAGE=true $(MAKE) bootstrap
BABEL_ENV=test BABEL_COVERAGE=true $(YARN) jest --maxWorkers=100% --ci

bootstrap-flow:
rm -rf build/flow
Expand Down
2 changes: 1 addition & 1 deletion Makefile.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Makefile.source.mjs
Expand Up @@ -377,6 +377,19 @@ target["test-only"] = function (args = []) {
yarn(["jest", ...args]);
};

target["test-cov"] = function () {
env(
() => {
target["build"]();
yarn(["jest", "--coverage"]);
},
{
BABEL_ENV: "test",
BABEL_COVERAGE: "true",
}
);
};

/**
* PUBLISH
*/
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Expand Up @@ -37,7 +37,7 @@ module.exports = {
// in production builds. They are marked using the .skip-bundled.js extension.
...(isPublishBundle ? ["\\.skip-bundled\\.js$"] : []),
// Ignore @babel/standalone test in coverage testing because it is not built
...(process.env.TEST_TYPE === "cov"
...(process.env.BABEL_COVERAGE === "true"
? ["<rootDir>/packages/babel-standalone/"]
: []),
],
Expand Down
11 changes: 0 additions & 11 deletions scripts/test-cov.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/test.sh
Expand Up @@ -10,7 +10,7 @@ if [ "$TEST_DEBUG" ]; then
fi

if [ -n "$CI" ]; then
jestArgs+=("--maxWorkers=4")
jestArgs+=("--maxWorkers=100%")
jestArgs+=("--ci")
fi

Expand Down