Skip to content

Commit

Permalink
test: fix constraints test to handle paths containing spaces (#5073)
Browse files Browse the repository at this point in the history
* test: fix constraints test to handle paths containing spaces

* test: avoid using regexp
  • Loading branch information
merceyz authored Nov 18, 2022
1 parent 4745bde commit 681b890
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const {npath} = require(`@yarnpkg/fslib`);
const {
fs: {writeFile},
} = require(`pkg-tests-core`);
Expand Down Expand Up @@ -110,7 +111,8 @@ describe(`Commands`, () => {
({code, stdout, stderr} = error);
}

stdout = stdout.replace(/[^( ]+[\\/](yarn\.config)/g, `/path/to/$1`);
// TODO: Use .replaceAll when we drop support for Node.js v14
stdout = stdout.split(npath.join(npath.fromPortablePath(path), `yarn.config.js`)).join(`/path/to/yarn.config.js`);
stdout = stdout.replace(/(Module|Object)\.(exports\.)/g, `$2`);

expect({code, stdout, stderr}).toMatchSnapshot();
Expand Down

0 comments on commit 681b890

Please sign in to comment.