Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[src/dev/build] remove node-version from snapshots #75303

Merged
merged 1 commit into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions src/dev/build/tasks/nodejs/extract_node_builds_task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
* under the License.
*/

import { readFileSync } from 'fs';
import Path from 'path';

import {
ToolingLog,
ToolingLogCollectingWriter,
createAbsolutePathSerializer,
createRecursiveSerializer,
REPO_ROOT,
} from '@kbn/dev-utils';

import { Config } from '../../lib';
Expand All @@ -37,6 +42,14 @@ log.setWriters([testWriter]);

expect.addSnapshotSerializer(createAbsolutePathSerializer());

const nodeVersion = readFileSync(Path.resolve(REPO_ROOT, '.node-version'), 'utf8').trim();
expect.addSnapshotSerializer(
createRecursiveSerializer(
(s) => typeof s === 'string' && s.includes(nodeVersion),
(s) => s.split(nodeVersion).join('<node version>')
)
);

async function setup() {
const config = await Config.create({
isRelease: true,
Expand Down Expand Up @@ -74,31 +87,31 @@ it('runs expected fs operations', async () => {
Object {
"copy": Array [
Array [
<absolute path>/.node_binaries/10.21.0/node.exe,
<absolute path>/.node_binaries/10.21.0/win32-x64/node.exe,
<absolute path>/.node_binaries/<node version>/node.exe,
<absolute path>/.node_binaries/<node version>/win32-x64/node.exe,
Object {
"clone": true,
},
],
],
"untar": Array [
Array [
<absolute path>/.node_binaries/10.21.0/node-v10.21.0-linux-x64.tar.gz,
<absolute path>/.node_binaries/10.21.0/linux-x64,
<absolute path>/.node_binaries/<node version>/node-v<node version>-linux-x64.tar.gz,
<absolute path>/.node_binaries/<node version>/linux-x64,
Object {
"strip": 1,
},
],
Array [
<absolute path>/.node_binaries/10.21.0/node-v10.21.0-linux-arm64.tar.gz,
<absolute path>/.node_binaries/10.21.0/linux-arm64,
<absolute path>/.node_binaries/<node version>/node-v<node version>-linux-arm64.tar.gz,
<absolute path>/.node_binaries/<node version>/linux-arm64,
Object {
"strip": 1,
},
],
Array [
<absolute path>/.node_binaries/10.21.0/node-v10.21.0-darwin-x64.tar.gz,
<absolute path>/.node_binaries/10.21.0/darwin-x64,
<absolute path>/.node_binaries/<node version>/node-v<node version>-darwin-x64.tar.gz,
<absolute path>/.node_binaries/<node version>/darwin-x64,
Object {
"strip": 1,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
* under the License.
*/

import Path from 'path';
import Fs from 'fs';

import {
ToolingLog,
ToolingLogCollectingWriter,
createAnyInstanceSerializer,
createRecursiveSerializer,
REPO_ROOT,
} from '@kbn/dev-utils';

import { Config, Platform } from '../../lib';
Expand All @@ -41,6 +46,14 @@ log.setWriters([testWriter]);

expect.addSnapshotSerializer(createAnyInstanceSerializer(Config));

const nodeVersion = Fs.readFileSync(Path.resolve(REPO_ROOT, '.node-version'), 'utf8').trim();
expect.addSnapshotSerializer(
createRecursiveSerializer(
(s) => typeof s === 'string' && s.includes(nodeVersion),
(s) => s.split(nodeVersion).join('<node version>')
)
);

async function setup(actualShaSums?: Record<string, string>) {
const config = await Config.create({
isRelease: true,
Expand Down Expand Up @@ -87,7 +100,7 @@ it('checks shasums for each downloaded node build', async () => {
[MockFunction] {
"calls": Array [
Array [
"10.21.0",
"<node version>",
],
],
"results": Array [
Expand Down