@kensio/yulin 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/pr.yml +54 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.nvmrc +1 -1
- package/README.md +43 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: PR
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
defaults:
|
|
10
|
+
run:
|
|
11
|
+
shell: bash
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
CI: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
name: Lint
|
|
19
|
+
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
- uses: pnpm/action-setup@v4
|
|
23
|
+
- uses: actions/setup-node@v6
|
|
24
|
+
with:
|
|
25
|
+
node-version-file: .nvmrc
|
|
26
|
+
cache: pnpm
|
|
27
|
+
- run: pnpm install --frozen-lockfile
|
|
28
|
+
- run: pnpm lint
|
|
29
|
+
|
|
30
|
+
test:
|
|
31
|
+
name: Test
|
|
32
|
+
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v6
|
|
35
|
+
- uses: pnpm/action-setup@v4
|
|
36
|
+
- uses: actions/setup-node@v6
|
|
37
|
+
with:
|
|
38
|
+
node-version-file: .nvmrc
|
|
39
|
+
cache: pnpm
|
|
40
|
+
- run: pnpm install --frozen-lockfile
|
|
41
|
+
- run: pnpm test:coverage
|
|
42
|
+
|
|
43
|
+
build:
|
|
44
|
+
name: Build
|
|
45
|
+
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v6
|
|
48
|
+
- uses: pnpm/action-setup@v4
|
|
49
|
+
- uses: actions/setup-node@v6
|
|
50
|
+
with:
|
|
51
|
+
node-version-file: .nvmrc
|
|
52
|
+
cache: pnpm
|
|
53
|
+
- run: pnpm install --frozen-lockfile
|
|
54
|
+
- run: pnpm build
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
v24.
|
|
1
|
+
v24.14.0
|
package/README.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
AWS system behaviour simulation for isolated unit testing
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -D @kensio/yulin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Still in alpha!
|
|
14
|
+
|
|
15
|
+
## What is yulin?
|
|
16
|
+
|
|
17
|
+
TLDR: yulin is an AWS simulator for testing Node.js applications.
|
|
18
|
+
|
|
19
|
+
The simulation is not only local to the machine, but in the same single process
|
|
20
|
+
with the test and application under test. No network or external i/o is
|
|
21
|
+
involved. This is what "isolated" refers to.
|
|
22
|
+
|
|
23
|
+
This "isolated system" approach to testing has a few advantages:
|
|
24
|
+
|
|
25
|
+
- Tests run fast as everything is in memory with no real networking.
|
|
26
|
+
- Test set-up is fast and uncomplicated, as there are no containers or extra
|
|
27
|
+
dependencies to manage.
|
|
28
|
+
- It's straightforward to use multiple other mocks and simulators alongside
|
|
29
|
+
yulin, such as [nock](https://github.com/nock/nock), as yulin makes no
|
|
30
|
+
assumptions about the environment.
|
|
31
|
+
- You can control everything in each isolated test process, such as controlling
|
|
32
|
+
the current time, even when multiple different AWS services are simulated.
|
|
33
|
+
- One test can cover **meaningful system behaviour** across multiple AWS
|
|
34
|
+
services and applications, such as Lambdas sending events to SQS queues to be
|
|
35
|
+
picked up by other Lambdas, or DynamoDB streams triggering Lambdas.
|
|
36
|
+
|
|
37
|
+
That last point is the most important. The motivation behind yulin is to enable
|
|
38
|
+
efficient tests that cover the logical behaviour of a system. That is in
|
|
39
|
+
contrast to less valuable microscopic unit tests with fiddly mocks and brittle
|
|
40
|
+
assertions. The goal of yulin is to allow you to test system behaviours that are
|
|
41
|
+
meaningful to users and stakeholders.
|
|
42
|
+
|
|
43
|
+
## What's in a name?
|
|
44
|
+
|
|
45
|
+
The word yǔlín (雨林) is Chinese for "rainforest". This is a roundabout reference
|
|
46
|
+
to "Amazon" as in Amazon Web Services.
|
|
47
|
+
|
|
5
48
|
## Development
|
|
6
49
|
|
|
7
50
|
Install pnpm
|