Skip to content

Commit

Permalink
chore: add webpack env var to dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jul 15, 2024
1 parent 3dd1107 commit 6592c42
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS=--openssl-legacy-provider
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ jobs:
run: pnpm build

- name: Test
env:
# This can't be added to the package.json script because we also test Node.js v16
# https://github.com/webpack/webpack/issues/14532
NODE_OPTIONS: --openssl-legacy-provider
run: pnpm test

- name: Test Node.js v16
run: pnpm --use-node-version=16.19.0 test
run: pnpm --use-node-version=16.19.0 tsx tests
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shell-emulator=true
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
},
"scripts": {
"build": "pkgroll --target=node16.19.0",
"test": "tsx tests",
"dev": "tsx watch --conditions=development tests",
"test": "tsx --env-file=.env tests",
"dev": "tsx watch --env-file=.env --conditions=development tests",
"lint": "lintroll --cache .",
"type-check": "tsc --noEmit",
"prepack": "pnpm build && clean-pkg-json"
Expand Down
5 changes: 2 additions & 3 deletions tests/specs/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { createFixture } from 'fs-fixture';
import { execa } from 'execa';
import { tsconfigJson } from '../utils.js';

const require = createRequire(import.meta.url);

const webpackCli = path.resolve('node_modules/webpack-cli/bin/cli.js');
const esbuildLoader = path.resolve('dist/index.cjs');

Expand Down Expand Up @@ -73,7 +75,6 @@ export default testSuite(({ describe }) => {
cwd: fixture.path,
});

const require = createRequire(import.meta.url);
expect(
require(path.join(fixture.path, 'dist/main.js')),
).toStrictEqual([true, false, true]);
Expand Down Expand Up @@ -127,7 +128,6 @@ export default testSuite(({ describe }) => {
cwd: fixture.path,
});

const require = createRequire(import.meta.url);
expect(
require(path.join(fixture.path, 'dist/main.js')),
).toStrictEqual([true, false]);
Expand Down Expand Up @@ -186,7 +186,6 @@ export default testSuite(({ describe }) => {

expect(stdout).toMatch('does not match its "include" patterns');

const require = createRequire(import.meta.url);
expect(
require(path.join(fixture.path, 'dist/main.js')),
).toStrictEqual([true, true]);
Expand Down

0 comments on commit 6592c42

Please sign in to comment.