Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: require dist/ipfs-sw-sw.js existence #106

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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
Loading