Skip to content

Commit

Permalink
test: require dist/ipfs-sw-sw.js existence (#106)
Browse files Browse the repository at this point in the history
* test: require dist/ipfs-sw-sw.js existence

* chore: fix postbuild test lint dir
  • Loading branch information
SgtPooki authored Mar 12, 2024
1 parent 1201b22 commit 089cacd
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .aegir.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import('aegir').PartialOptions} */
export default {
lint: {
files: ['src/**/*.ts', 'src/**/*.tsx', 'tests/**/*']
files: ['src/**/*.ts', 'src/**/*.tsx', 'tests/**/*', 'test/**/*.js']
},
dependencyCheck: {
ignore: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"lint": "aegir lint",
"lint:fix": "aegir lint --fix",
"build": "run-s dep-check lint build:webpack",
"postbuild": "aegir test --build=false",
"build:webpack": "webpack --env production",
"serve": "webpack serve --mode=development",
"serve:prod": "webpack serve --mode=production",
Expand Down
5 changes: 5 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Tests

These tests are ran using `aegir test`.

Since we don't use aegir for building our dist folder, we need all tests in this directory to be javascript files. This is a temporary solution until we can use aegir for building our dist folder.
17 changes: 17 additions & 0 deletions test/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-env mocha */
import { constants } from 'node:fs'
import { access } from 'node:fs/promises'
import { resolve, dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { expect } from 'aegir/chai'

const cwd = dirname(fileURLToPath(import.meta.url))

describe('verify-dist', async () => {
it('has a service worker with the correct name', async () => {
/**
* test to confirm that the service worker generated in /dist does not change names
*/
await expect(access(resolve(cwd, '../dist/ipfs-sw-sw.js'), constants.F_OK)).to.not.be.rejected()
})
})
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"include": [
"src",
"tests",
"webpack-tests",
"types/svg.d.ts"
]
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const splitChunks = {
const paths = {
// Source files
src: path.resolve(__dirname, './src'),
testSrc: path.resolve(__dirname, './tests'),
testSrc: path.resolve(__dirname, './webpack-tests'),
testBuild: path.resolve(__dirname, './test-build'),

// Production build files
Expand Down

0 comments on commit 089cacd

Please sign in to comment.