diff --git a/.gitignore b/.gitignore
index f60668fe45..78b797fbb1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ node_modules
package-lock.json
create-snowpack-app/*/build
test/build/**/build
+test/build/**/web_modules
test/create-snowpack-app/test-install
test/esinstall/**/web_modules
yarn-error.log
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 74cc8e8d2d..573bd30180 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -58,6 +58,8 @@ yarn test:dev # might fail on windows, see #1171
### Snapshot tests
+_Update Dec 2020: we’re working on improving this! Snapshots are now mostly gone from `test/build`, and we’ll be working through `test/esinstall` next. We‘ll wait to finish the work before updating this section, but know that this may become outdated soon._
+
The way our snapshot tests work is they test Snowpack by building the codebases in `test/build`. You'll almost always have a "failed" snapshot test when you make a contribution because your new change will make the final build different. You'll want to take a new snapshot. To do this run:
```bash
diff --git a/package.json b/package.json
index 5d6b79b835..a0c7b4db1d 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,6 @@
"lint": "lerna run lint --parallel --scope=esinstall --scope=snowpack --scope=skypack",
"publish": "npm run build && lerna publish --no-private",
"format": "prettier --write '{snowpack,esinstall}/src/**/*.{ts,js}' '{test,plugins}/**/*.{ts,js}' '*.{js,json,md}' '**/*.{json,md}' '.github/**/*.{md,yml}' '!**/{_dist_,build,packages,pkg,TEST_BUILD_OUT,web_modules}/**' !test/create-snowpack-app/test-install",
- "pretest": "node test/setup.js",
"test": "jest --testPathIgnorePatterns=/test-dev/ --test-timeout=30000",
"test:dev": "jest /test-dev/ --test-timeout=30000",
"test:docs": "cd www && yarn && yarn test --passWithNoTests"
diff --git a/test/build/base-url-homepage/base-url-homepage.test.js b/test/build/base-url-homepage/base-url-homepage.test.js
index c6f8a685b8..348a53de6f 100644
--- a/test/build/base-url-homepage/base-url-homepage.test.js
+++ b/test/build/base-url-homepage/base-url-homepage.test.js
@@ -1,18 +1,26 @@
-const fs = require('fs');
const path = require('path');
const cheerio = require('cheerio');
+const {setupBuildTest, readFiles} = require('../../test-utils');
-const html = fs.readFileSync(path.join(__dirname, 'build', 'index.html'), 'utf8');
+const cwd = path.join(__dirname, 'build');
-const $ = cheerio.load(html);
+let files = {};
describe('packageManifest.homepage', () => {
+ beforeAll(() => {
+ setupBuildTest(__dirname);
+
+ files = readFiles(['index.html'], {cwd});
+ });
+
it('baseUrl works for ', () => {
+ const $ = cheerio.load(files['/index.html']);
expect($('link[rel="icon"]').attr('href').startsWith('/static/')).toBe(true);
expect($('link[rel="stylesheet"]').attr('href').startsWith('/static/')).toBe(true);
});
it('baseUrl works for
-
-