generated from netlify/build-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (27 loc) · 922 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import test from 'ava'
import { fileURLToPath } from 'url'
import netlifyBuild from '@netlify/build'
const NETLIFY_CONFIG = fileURLToPath(
new URL('../netlify.toml', import.meta.url),
)
// Unit tests are using the AVA test runner: https://github.com/avajs/ava
// A local build is performed using the following command:
// netlify-build --config ../netlify.toml
// Please see this netlify.toml configuration file. It simply runs the
// Build plugin.
// This is a smoke test. You will probably want to write more elaborate unit
// tests to cover your plugin's logic.
test('Netlify Build should not fail', async (t) => {
const { success, logs } = await netlifyBuild({
config: NETLIFY_CONFIG,
buffer: true,
})
// Netlify Build output
console.log(
[logs.stdout.join('\n'), logs.stderr.join('\n')]
.filter(Boolean)
.join('\n\n'),
)
// Check that build succeeded
t.true(success)
})