How to use the ava.default.serial function in ava

To help you get started, we’ve selected a few ava examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jasongin / nvs / test / modules / autoTests.js View on Github external
t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto download and switch based on parent dir', t => {
	mockFs.mockFile('/testA/.node-version', '2.3.4');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsAddRemove.addedVersions.length, 1);
		t.is(mockNvsAddRemove.addedVersions[0].semanticVersion, '2.3.4');
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '2.3.4');
	});
});

test.serial('Auto download and switch based on parent dir using nvmrc', t => {
	mockFs.mockFile('/testA/.nvmrc', '2.3.4');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsAddRemove.addedVersions.length, 1);
		t.is(mockNvsAddRemove.addedVersions[0].semanticVersion, '2.3.4');
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '2.3.4');
	});
});
github jasongin / nvs / test / modules / autoTests.js View on Github external
t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on parent dir', t => {
	mockFs.mockFile('/testA/.node-version', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto download and switch based on parent dir', t => {
	mockFs.mockFile('/testA/.node-version', '2.3.4');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsAddRemove.addedVersions.length, 1);
		t.is(mockNvsAddRemove.addedVersions[0].semanticVersion, '2.3.4');
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '2.3.4');
	});
});

test.serial('Auto download and switch based on parent dir using nvmrc', t => {
	mockFs.mockFile('/testA/.nvmrc', '2.3.4');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsAddRemove.addedVersions.length, 1);
		t.is(mockNvsAddRemove.addedVersions[0].semanticVersion, '2.3.4');
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '2.3.4');
github jasongin / nvs / test / modules / autoTests.js View on Github external
test.beforeEach(t => {
	mockFs.reset();
	mockNvsUse.usedVersions = [];
	mockNvsAddRemove.addedVersions = [];
});

test.serial('Auto switch to default', t => {
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0], 'default');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on current dir', t => {
	mockFs.mockFile('/testA/testB/.node-version', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on current dir using nvmrc', t => {
	mockFs.mockFile('/testA/testB/.nvmrc', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});
github jasongin / nvs / test / modules / autoTests.js View on Github external
t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0], 'default');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on current dir', t => {
	mockFs.mockFile('/testA/testB/.node-version', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on current dir using nvmrc', t => {
	mockFs.mockFile('/testA/testB/.nvmrc', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on parent dir', t => {
	mockFs.mockFile('/testA/.node-version', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});
github jasongin / nvs / test / modules / autoTests.js View on Github external
},
};

nvsAuto.__set__('fs', mockFs);
nvsAuto.__set__('nvsUse', mockNvsUse);
nvsAuto.__set__('nvsAddRemove', mockNvsAddRemove);
nvsAuto.__set__('nvsList', mockNvsList);
nvsAuto.__set__('nvsLink', mockNvsLink);

test.beforeEach(t => {
	mockFs.reset();
	mockNvsUse.usedVersions = [];
	mockNvsAddRemove.addedVersions = [];
});

test.serial('Auto switch to default', t => {
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0], 'default');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on current dir', t => {
	mockFs.mockFile('/testA/testB/.node-version', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});
github jasongin / nvs / test / modules / autoTests.js View on Github external
t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on current dir using nvmrc', t => {
	mockFs.mockFile('/testA/testB/.nvmrc', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto switch based on parent dir', t => {
	mockFs.mockFile('/testA/.node-version', '1.2.3');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '1.2.3');
		t.deepEqual(mockNvsAddRemove.addedVersions, []);
	});
});

test.serial('Auto download and switch based on parent dir', t => {
	mockFs.mockFile('/testA/.node-version', '2.3.4');
	return nvsAuto.autoSwitchAsync('/testA/testB').then(() => {
		t.is(mockNvsAddRemove.addedVersions.length, 1);
		t.is(mockNvsAddRemove.addedVersions[0].semanticVersion, '2.3.4');
		t.is(mockNvsUse.usedVersions.length, 1);
		t.is(mockNvsUse.usedVersions[0].semanticVersion, '2.3.4');
	});