Skip to content

Commit 99d3d81

Browse files
authored
Prevent unit/integration tests from running against stale build artifacts (#55)
Closes #54. <!-- (REQUIRED) What is the nature of this PR? --> ## This PR is a: [ ] New feature [ ] Enhancement/Optimization [ ] Refactor [X] Bugfix [ ] Test for existing code [ ] Documentation <!-- (REQUIRED) What does this PR change? --> ## Summary See #54 . <!-- (OPTIONAL) What other information can you provide about this PR? --> ## Additional information <!-- Thank you for your contribution! Before submitting this pull request, please make sure you have read our Contribution Guidelines and your PR meets our contribution standards: https://github.com/magento-research/venia-pwa-concept/blob/master/.github/CONTRIBUTION.md Please fill out as much information as you can about your PR to help speed up the review process. If your PR addresses an existing GitHub Issue, please refer to it in the title or Additional Information section to make the connection. We may ask you for changes in your PR in order to meet the standards set in our Contribution Guidelines. PR's that do not comply with our guidelines may be closed at the maintainers' discretion. Feel free to remove this section before creating this PR. -->
1 parent e8ab642 commit 99d3d81

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

.circleci/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ jobs:
1313
- v1-npm-cache-{{ .Branch }}
1414
- v1-npm-cache-
1515

16-
# Install root devDependencies and bootstrap packages
16+
# Install root devDependencies and bootstrap packages. We use
17+
# --ignore-scripts to prevent building any artifacts to disk prior
18+
# to running Jest. This is a safeguard to ensure our tests always operate
19+
# on the latest source
1720
- run:
1821
name: Install shared devDependencies
1922
command: 'npm install --ignore-scripts'

packages/venia-concept/jest.config.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
const { join } = require('path');
2+
13
module.exports = {
24
displayName: 'Venia Concept',
35
browser: true,
46
moduleNameMapper: {
57
'\\.css$': 'identity-obj-proxy',
6-
'^src/(.+)': '<rootDir>/src/$1'
7-
}
8+
// Mirrors webpack alias to resolve from 'src'
9+
'^src/(.+)': '<rootDir>/src/$1',
10+
// Re-write imports to Peregrine to ensure they're not pulled from the
11+
// (possibly outdated) build artifacts on disk in `dist`.
12+
// Ideally this rule would be in the root Jest config, but Jest's config
13+
// merging strategy isn't currently smart enough for this. TODO: Look
14+
// into moving to root config in later versions of Jest if config merging
15+
// improves
16+
'^@magento/peregrine(/*(?:.+)*)': join(__dirname, '../peregrine/src/$1')
17+
},
18+
// Have Jest use Babel to transpile Peregrine imports in tests, since
19+
// our cross-package tests in the monorepo should all operate on `src`
20+
transformIgnorePatterns: ['node_modules/(?!@magento/peregrine)']
821
};

packages/venia-concept/package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/venia-concept/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"start:debug": "node --inspect-brk ./node_modules/.bin/webpack-dev-server --progress --color --env.phase development"
1717
},
1818
"dependencies": {
19-
"@magento/peregrine": "^0.3.0",
19+
"@magento/peregrine": "^0.4.0",
2020
"babel-runtime": "^6.26.0",
2121
"dotenv": "^4.0.0",
2222
"feather-icons": "^4.6.0",

0 commit comments

Comments
 (0)