Skip to content

Commit

Permalink
test: add test for commonJS exports
Browse files Browse the repository at this point in the history
  • Loading branch information
skjalgepalg committed Oct 10, 2023
1 parent 86cd2fb commit 767e42f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"publish:minor": "npm version minor -m 'Release minor %s'",
"publish:major": "npm version major -m 'Release major %s'",
"lint": "standard",
"test": "node test/core-icons.test.mjs",
"test": "node test/core-icons.test.mjs && node test/core-icons.test.js",
"preversion": "testpack",
"postversion": "npm run build && git push && git push --tags && npm publish",
"start": "npm run build:watch & http-server ./static -o -p 10001 -c-1",
Expand Down
13 changes: 13 additions & 0 deletions test/core-icons.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Test package exports using testpack-cli
const icons = require('@nrk/core-icons')
const expressive = require('@nrk/core-icons/expressive')
const logos = require('@nrk/core-icons/logo')
const previews = require('@nrk/core-icons/preview')

console.info(`
Package contains the following for commonJS:\n
- ${Object.keys(icons).length} icons\n
- ${Object.keys(expressive).length} expressive icons\n
- ${Object.keys(logos).length} logos\n
- ${Object.keys(previews).length} previews\n
`)
4 changes: 2 additions & 2 deletions test/core-icons.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as logos from '@nrk/core-icons/logo'
import * as previews from '@nrk/core-icons/preview'

console.info(`
Package contains the following:\n
Package contains the following for ESM:\n
- ${Object.keys(icons).length} icons\n
- ${Object.keys(expressive).length} expressive icons\n
- ${Object.keys(logos).length} logos\n
- ${Object.keys(previews).length} logos\n
- ${Object.keys(previews).length} previews\n
`)

0 comments on commit 767e42f

Please sign in to comment.