Skip to content

Commit

Permalink
Fix example plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
alcuadrado committed May 17, 2024
1 parent c3d5ddd commit 385b16e
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 9 deletions.
3 changes: 2 additions & 1 deletion examples/example-node-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"test:fix": "pnpm lint:fix && pnpm format:fix && pnpm test && pnpm typecheck"
},
"dependencies": {
"earl": "workspace:^1.2.1"
"earl": "workspace:^1.2.1",
"example-plugin": "workspace:^"
},
"devDependencies": {
"@voxpelli/node-test-pretty-reporter": "^1.1.1",
Expand Down
22 changes: 22 additions & 0 deletions examples/example-node-runner/src/example-plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from 'earl'
import 'example-plugin'

describe('example-plugin', () => {
it('EvenNumberMatcher works', () => {
expect(2).toEqual(expect.evenNumber())
})

it('EvenNumberMatchers is type safe', () => {
// @ts-expect-error - type mismatch
expect('2').not.toEqual(expect.evenNumber())
})

it('toBeEven works', () => {
expect(2).toBeEven()
})

it('toBeEven is type safe', () => {
// @ts-expect-error - type mismatch
expect('foo').not.toBeEven()
})
})
1 change: 1 addition & 0 deletions examples/example-plugin/cjs-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "type": "commonjs" }
13 changes: 8 additions & 5 deletions examples/example-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"private": true,
"version": "1.0.0",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.js",
"type": "module",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.js"
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}
},
"scripts": {
Expand All @@ -19,7 +20,9 @@
"lint:fix": "biome check --apply ./src",
"typecheck": "tsc --noEmit",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"build": "pnpm clean && tsc --build",
"build": "pnpm run clean && pnpm run build:esm && pnpm run build:cjs",
"build:esm": "tsc -p tsconfig.esm.json",
"build:cjs": "tsc -p tsconfig.cjs.json && cp cjs-package.json dist/cjs/package.json",
"test:fix": "pnpm lint:fix && pnpm format:fix && pnpm typecheck"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/example-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import './evenNumber'
import './toBeEven'
import './evenNumber.js'
import './toBeEven.js'
10 changes: 10 additions & 0 deletions examples/example-plugin/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node",
"verbatimModuleSyntax": false,
"outDir": "dist/cjs"
},
"exclude": ["dist", "src/test", "src/**/*.test.ts"]
}
4 changes: 4 additions & 0 deletions examples/example-plugin/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist", "src/test", "src/**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion examples/example-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"outDir": "dist/esm",
"rootDir": "src"
},
"include": ["src"]
Expand Down

0 comments on commit 385b16e

Please sign in to comment.