Skip to content

Commit

Permalink
Merge pull request #16 from AthennaIO/develop
Browse files Browse the repository at this point in the history
Migrate project to TS
  • Loading branch information
jlenon7 authored Jan 24, 2023
2 parents 929f98f + c901cd1 commit 33b6f1b
Show file tree
Hide file tree
Showing 73 changed files with 4,650 additions and 5,955 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ jobs:

- name: Install dependencies
run: npm install

- name: Transpile code
run: npm run build

- name: Automatic GitHub Release
uses: justincy/[email protected]
id: release

- name: Publish to NPM Registry
run: npm publish --access public
if: steps.release.outputs.released == 'true'
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ jobs:

- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test:coverage

- name: Test code transpilation
run: npm run build

windows:
runs-on: windows-latest
strategy:
Expand All @@ -46,5 +50,9 @@ jobs:

- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test:coverage

- name: Test code transpilation
run: npm run build
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ out
.yarn/install-state.gz
.pnp.*

# Transpiled code path
dist
build

# IDE
.idea
.fleet
.vscode

# Environment variables file
Expand Down
25 changes: 25 additions & 0 deletions bin/japaTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @athenna/common
*
* (c) João Lenon <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare module '@japa/assert' {
export interface Assert {
throws(fn: () => void, errType: any, message?: string): void
doesNotThrows(fn: () => void, errType: any, message?: string): void
rejects(
fn: () => void | Promise<void>,
errType: any,
message?: string,
): Promise<void>
doesNotRejects(
fn: () => void | Promise<void>,
errType: any,
message?: string,
): Promise<void>
}
}
15 changes: 14 additions & 1 deletion tests/index.js → bin/test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
/**
* @athenna/common
*
* (c) João Lenon <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

import { pathToFileURL } from 'url'
import { assert } from '@japa/assert'
import { specReporter } from '@japa/spec-reporter'
import { processCliArgs, configure, run } from '@japa/runner'

import('./japaTypes.js')

/*
|--------------------------------------------------------------------------
| Configure tests
Expand All @@ -17,10 +28,12 @@ import { processCliArgs, configure, run } from '@japa/runner'
| Please consult japa.dev/runner-config for the config docs.
*/

process.env.IS_TS = 'true'

configure({
...processCliArgs(process.argv.slice(2)),
...{
files: ['tests/**/*Test.js'],
files: ['tests/**/*Test.ts'],
plugins: [assert()],
reporters: [specReporter()],
importer: filePath => import(pathToFileURL(filePath).href),
Expand Down
Loading

0 comments on commit 33b6f1b

Please sign in to comment.