Skip to content

Commit

Permalink
updated: Modernize the unit test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed Apr 26, 2024
1 parent 68744c2 commit bc48769
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 259 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ npm i @riotjs/register @riotjs/compiler

## Usage

You can enable the import of `.riot` files as follows:
1. Create a module loader file as follows:

```js
import { pathToFileURL } from "node:url";
import { pathToFileURL } from 'node:url'
import { register } from 'node:module'

register('@riotjs/register', pathToFileURL('./'))
```

2. Require the code above by running node as follows:

```shell
node --import ./register-riot.js your-program.js
```

Where `register-riot.js` is the file where you have pasted the module loader example described above.

This loader supports only [`type=module`](https://nodejs.org/api/packages.html#packagejson-and-file-extensions) projects.

[ci-image]: https://img.shields.io/github/actions/workflow/status/riot/register/test.yml?style=flat-square
Expand Down
Loading

0 comments on commit bc48769

Please sign in to comment.