Skip to content

Commit

Permalink
Moved tests over to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
marziply committed Aug 18, 2021
1 parent 25db9ea commit 9aab48a
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 11 deletions.
8 changes: 8 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

node \
--no-warnings \
--experimental-json-modules \
--experimental-vm-modules node_modules/jest/bin/jest.js \
-c jest.config.json \
$@
17 changes: 17 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"transform": {},
"coverageDirectory": "./coverage",
"coverageProvider": "v8",
"coverageReporters": [
"cobertura"
],
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"testMatch": [
"**/tests/**/*.spec.js"
]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"version": "2.0.0",
"description": "Yank values from a given object via a specified schema",
"author": "marziply [email protected]",
"type": "module",
"scripts": {
"test": "node --no-warnings --experimental-vm-modules node_modules/.bin/jest.js",
"test": "bin/test.sh",
"build": "rollup -c",
"lint": "eslint ./src/*.js"
},
Expand All @@ -28,7 +29,7 @@
"node": ">=14.x",
"browsers": "> 0.25%"
},
"main": "dist/yankee-doodle.min.js",
"main": "./index.js",
"homepage": "https://github.com/marziply/yankee-doodle#readme",
"license": "MIT",
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions tests/filters.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const yank = require('../src/yank')
const filters = require('../src/filters')
const data = require('./data')
import { jest } from '@jest/globals'
import yank from '../src/yank.js'
import filters from '../src/filters.js'
import data from './data.json'

describe('src/filters', () => {
describe('as', () => {
Expand Down
3 changes: 2 additions & 1 deletion tests/parser.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { Parser, tokens } = require('../src/parser')
import { jest } from '@jest/globals'
import Parser, { tokens } from '../src/parser.js'

const schemas = [
'firstName',
Expand Down
4 changes: 2 additions & 2 deletions tests/serialiser.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Serialiser } = require('../src/serialiser')
const data = require('./data')
import Serialiser from '../src/serialiser.js'
import data from './data.json'

const node = {
children: [],
Expand Down
2 changes: 1 addition & 1 deletion tests/validator.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { validate } = require('../src/validator')
import validate from '../src/validator.js'

describe('src/validator', () => {
it('should return the schemas is all schemas are strings', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/yank.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const yank = require('../src/yank')
const data = require('./data')
import yank from '../src/yank.js'
import data from './data.json'

describe('src/yank', () => {
it('should yank provided properties from a data object', () => {
Expand Down

0 comments on commit 9aab48a

Please sign in to comment.