Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
refactor: migrate to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Jun 23, 2023
1 parent a8366c7 commit bc28e3d
Show file tree
Hide file tree
Showing 16 changed files with 302 additions and 20,627 deletions.
7 changes: 0 additions & 7 deletions .bin/test.js

This file was deleted.

7 changes: 0 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,5 @@ insert_final_newline = true
[*.json]
insert_final_newline = ignore

[**.min.js]
indent_style = ignore
insert_final_newline = ignore

[MakeFile]
indent_style = space

[*.md]
trim_trailing_whitespace = false
70 changes: 0 additions & 70 deletions .github/COMMIT_CONVENTION.md

This file was deleted.

170 changes: 170 additions & 0 deletions .github/labels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
[
{
"name": "Priority: Critical",
"color": "ea0056",
"description": "The issue needs urgent attention",
"aliases": []
},
{
"name": "Priority: High",
"color": "5666ed",
"description": "Look into this issue before picking up any new work",
"aliases": []
},
{
"name": "Priority: Medium",
"color": "f4ff61",
"description": "Try to fix the issue for the next patch/minor release",
"aliases": []
},
{
"name": "Priority: Low",
"color": "87dfd6",
"description": "Something worth considering, but not a top priority for the team",
"aliases": []
},
{
"name": "Semver: Alpha",
"color": "008480",
"description": "Will make it's way to the next alpha version of the package",
"aliases": []
},
{
"name": "Semver: Major",
"color": "ea0056",
"description": "Has breaking changes",
"aliases": []
},
{
"name": "Semver: Minor",
"color": "fbe555",
"description": "Mainly new features and improvements",
"aliases": []
},
{
"name": "Semver: Next",
"color": "5666ed",
"description": "Will make it's way to the bleeding edge version of the package",
"aliases": []
},
{
"name": "Semver: Patch",
"color": "87dfd6",
"description": "A bug fix",
"aliases": []
},
{
"name": "Status: Abandoned",
"color": "ffffff",
"description": "Dropped and not into consideration",
"aliases": ["wontfix"]
},
{
"name": "Status: Accepted",
"color": "e5fbf2",
"description": "The proposal or the feature has been accepted for the future versions",
"aliases": []
},
{
"name": "Status: Blocked",
"color": "ea0056",
"description": "The work on the issue or the PR is blocked. Check comments for reasoning",
"aliases": []
},
{
"name": "Status: Completed",
"color": "008672",
"description": "The work has been completed, but not released yet",
"aliases": []
},
{
"name": "Status: In Progress",
"color": "73dbc4",
"description": "Still banging the keyboard",
"aliases": ["in progress"]
},
{
"name": "Status: On Hold",
"color": "f4ff61",
"description": "The work was started earlier, but is on hold now. Check comments for reasoning",
"aliases": ["On Hold"]
},
{
"name": "Status: Review Needed",
"color": "fbe555",
"description": "Review from the core team is required before moving forward",
"aliases": []
},
{
"name": "Status: Awaiting More Information",
"color": "89f8ce",
"description": "Waiting on the issue reporter or PR author to provide more information",
"aliases": []
},
{
"name": "Status: Need Contributors",
"color": "7057ff",
"description": "Looking for contributors to help us move forward with this issue or PR",
"aliases": []
},
{
"name": "Type: Bug",
"color": "ea0056",
"description": "The issue has indentified a bug",
"aliases": ["bug"]
},
{
"name": "Type: Security",
"color": "ea0056",
"description": "Spotted security vulnerability and is a top priority for the core team",
"aliases": []
},
{
"name": "Type: Duplicate",
"color": "00837e",
"description": "Already answered or fixed previously",
"aliases": ["duplicate"]
},
{
"name": "Type: Enhancement",
"color": "89f8ce",
"description": "Improving an existing feature",
"aliases": ["enhancement"]
},
{
"name": "Type: Feature Request",
"color": "483add",
"description": "Request to add a new feature to the package",
"aliases": []
},
{
"name": "Type: Invalid",
"color": "dbdbdb",
"description": "Doesn't really belong here. Maybe use discussion threads?",
"aliases": ["invalid"]
},
{
"name": "Type: Question",
"color": "eceafc",
"description": "Needs clarification",
"aliases": ["help wanted", "question"]
},
{
"name": "Type: Documentation Change",
"color": "7057ff",
"description": "Documentation needs some improvements",
"aliases": ["documentation"]
},
{
"name": "Type: Dependencies Update",
"color": "00837e",
"description": "Bump dependencies",
"aliases": ["dependencies"]
},
{
"name": "Good First Issue",
"color": "008480",
"description": "Want to contribute? Just filter by this label",
"aliases": ["good first issue"]
}
]
4 changes: 2 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ daysUntilClose: 7

# Issues with these labels will never be considered stale
exemptLabels:
- "Type: Security"
- 'Type: Security'

# Label to use when marking an issue as stale
staleLabel: "Status: Abandoned"
staleLabel: 'Status: Abandoned'

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Expand Down
28 changes: 10 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
name: test
name: checks
on:
- push
- pull_request

jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16.13.1
- 17.x
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
- name: Run tests
run: npm test
test:
uses: japa/.github/.github/workflows/test.yml@main

lint:
uses: japa/.github/.github/workflows/lint.yml@main

typecheck:
uses: japa/.github/.github/workflows/typecheck.yml@main
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
38 changes: 38 additions & 0 deletions bin/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { assert } from '@japa/assert'
import { specReporter } from '@japa/spec-reporter'
import { runFailedTests } from '@japa/run-failed-tests'
import { processCliArgs, configure, run } from '@japa/runner'
import { pathToFileURL } from 'node:url'

/*
|--------------------------------------------------------------------------
| Configure tests
|--------------------------------------------------------------------------
|
| The configure method accepts the configuration to configure the Japa
| tests runner.
|
| The first method call "processCliArgs" process the command line arguments
| and turns them into a config object. Using this method is not mandatory.
|
| Please consult japa.dev/runner-config for the config docs.
*/
configure({
...processCliArgs(process.argv.slice(2)),
...{
files: ['tests/**/*.spec.ts'],
plugins: [assert(), runFailedTests()],
reporters: [specReporter()],
importer: (filePath) => import(pathToFileURL(filePath).href),
},
})

/*
|--------------------------------------------------------------------------
| Run tests
|--------------------------------------------------------------------------
|
| The following "run" method is required to execute all the tests.
|
*/
run()
2 changes: 1 addition & 1 deletion examples/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { Emitter } from '@japa/core'
import { fire } from '../index'
import { fire } from '../index.js'
const emitter = new Emitter()

emitter.on('suite:start', (suite) => console.log(suite.name))
Expand Down
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import { Emitter } from '@japa/core'

import testEvents from './src/events/tests'
import groupEvents from './src/events/groups'
import suitesEvents from './src/events/suites'
import testEvents from './src/events/tests.js'
import groupEvents from './src/events/groups.js'
import suitesEvents from './src/events/suites.js'

export async function fire(emitter: Emitter) {
emitter.emit('runner:start', {})
Expand Down
Loading

0 comments on commit bc28e3d

Please sign in to comment.