1.3.3 • Published 8 months ago

test-ipfs-example v1.3.3

Weekly downloads
74
License
Apache-2.0 OR MIT
Repository
github
Last release
8 months ago

test-ipfs-example

codecov CI

A test suite for testing examples using playwright for browsers and simple output matching for node

Install

$ npm i test-ipfs-example

Browser <script> tag

Loading this module through a script tag will make it's exports available as TestIpfsExample in the global namespace.

<script src="https://unpkg.com/test-ipfs-example/dist/index.min.js"></script>

Table of contents

Usage

Node.js tests

To run node js tests, create a test file similar to:

import { waitForOutput } from 'test-ipfs-example/node'

await waitForOutput('the output to expect', 'path/to/example.js')

Run it from your package.json

{
  "scripts": {
    "test": "test-node-example ./my-test.spec.js"
  }
}

Browser tests

To run browser tests, create a test file similar to:

import { setup, expect } from 'test-ipfs-example/browser'

const test = setup({
  // optionally configure server(s) - if omitted one will be created listening
  // on a random high port that serves the contents of the `dist` folder in
  // the root of the example
  servers: [{
    port: 0,
    host: '127.0.0.1',
    path: 'dist'
  }]
})

test.describe('test a browser app', () => {
  test.beforeEach(async ({ servers, page }) => {
    await page.goto(servers[0].url)
  })

  test('should have browser success', async ({ page }) => {
    // make some playwright assertions here
    await page.waitForSelector('#app')
    const connections = await page.textContent('#app')
    expect(connections).toContain('hello world')
  })
})

Run it from your package.json

{
  "scripts": {
    "test": "test-browser-example ./my-test.spec.js"
  }
}

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

1.3.3

8 months ago

1.3.2

8 months ago

1.3.1

8 months ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

3.0.0

4 years ago

2.1.1-rc.79

4 years ago

2.1.1-rc.61

4 years ago

2.1.1-rc.60

4 years ago

2.1.1-rc.59

4 years ago

2.1.1-rc.58

4 years ago

2.1.1-rc.56

4 years ago

2.1.1-rc.51

5 years ago

2.1.1-rc.49

5 years ago

2.1.1-rc.46

5 years ago

2.1.1-rc.45

5 years ago

2.1.1-rc.42

5 years ago

2.1.1-rc.41

5 years ago

2.1.1-rc.40

5 years ago

2.1.1-rc.39

5 years ago

2.1.1-rc.35

5 years ago

2.1.1-rc.33

5 years ago

2.1.1-rc.30

5 years ago

2.1.1-rc.29

5 years ago

2.1.1-rc.24

5 years ago

2.1.1-rc.23

5 years ago

2.1.1-rc.21

5 years ago

2.1.1-rc.19

5 years ago

2.1.1-rc.17

5 years ago

2.1.1-rc.13

5 years ago

2.1.1-rc.12

5 years ago

2.1.1-rc.10

5 years ago

2.1.1-rc.8

5 years ago

2.1.1-rc.6

5 years ago

2.1.1-rc.4

5 years ago

2.1.1-rc.5

5 years ago

2.1.1-rc.2

5 years ago

2.1.0

5 years ago

2.0.4-rc.190

5 years ago

2.0.4-rc.188

5 years ago

2.0.4-rc.187

5 years ago

2.0.4-rc.185

5 years ago

2.0.4-rc.184

5 years ago

2.0.4-rc.183

5 years ago

2.0.4-rc.181

5 years ago

2.0.4-rc.175

5 years ago

2.0.4-rc.174

5 years ago

2.0.4-rc.173

5 years ago

2.0.4-rc.171

5 years ago

2.0.4-rc.170

5 years ago

2.0.4-rc.168

5 years ago

2.0.4-rc.169

5 years ago

2.0.4-rc.166

5 years ago

2.0.4-rc.165

5 years ago

2.0.4-rc.163

5 years ago

2.0.4-rc.162

5 years ago

2.0.4-rc.161

5 years ago

2.0.4-rc.160

5 years ago

2.0.4-rc.156

5 years ago

2.0.4-rc.150

5 years ago

2.0.3

5 years ago

2.0.3-rc.5

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.0.1-rc.5621

5 years ago