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

[INTERNAL] Travis: Activate Windows and Mac builds #100

Merged
merged 4 commits into from
Dec 18, 2018
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
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
19 changes: 16 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
language: node_js # don't install any environment

node_js:
- "8"
- "10"
- "node"

os:
- linux
- osx
- windows

matrix:
include:
- os: linux
node_js:
- "10"
- os: linux
node_js:
- "8"

after_script:
- npm run report-coveralls
- if [[ "$TRAVIS_OS_NAME" == 'linux' ]]; then npm run report-coveralls; fi

notifications:
webhooks: https://coveralls.io/webhook
116 changes: 54 additions & 62 deletions test/lib/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const {test} = require("ava");
const path = require("path");
const chai = require("chai");
chai.use(require("chai-fs"));
const fs = require("graceful-fs");
const {promisify} = require("util");
const readFile = promisify(fs.readFile);
const assert = chai.assert;

const ui5Builder = require("../../../");
Expand All @@ -17,6 +20,8 @@ const libraryCore = path.join(__dirname, "..", "..", "fixtures", "sap.ui.core-ev

const recursive = require("recursive-readdir");

const newLineRegexp = /\r?\n|\r/g;

const findFiles = (folder) => {
return new Promise((resolve, reject) => {
recursive(folder, (err, files) => {
Expand All @@ -41,9 +46,23 @@ function cloneProjectTree(tree) {
return clone;
}

async function checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath) {
for (let i = 0; i < expectedFiles.length; i++) {
const expectedFile = expectedFiles[i];
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
const currentFileContentPromise = readFile(destFile, "utf8");
const expectedFileContentPromise = readFile(expectedFile, "utf8");
const assertContents = ([currentContent, expectedContent]) => {
assert.equal(currentContent.replace(newLineRegexp, "\n"), expectedContent.replace(newLineRegexp, "\n"));
};
await Promise.all([currentFileContentPromise, expectedFileContentPromise]).then(assertContents);
}
}

test("Build application.a", (t) => {
const destPath = "./test/tmp/build/application.a/dest";
const expectedPath = "./test/expected/build/application.a/dest";
const expectedPath = path.join("test", "expected", "build", "application.a", "dest");

return builder.build({
tree: applicationATree,
Expand All @@ -55,18 +74,15 @@ test("Build application.a", (t) => {
// Check for all directories and files
assert.directoryDeepEqual(destPath, expectedPath);
// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build application.a [dev mode]", (t) => {
const destPath = "./test/tmp/build/application.a/dest-dev";
const expectedPath = "./test/expected/build/application.a/dest-dev";
const expectedPath = path.join("test", "expected", "build", "application.a", "dest-dev");

return builder.build({
tree: applicationATree,
Expand All @@ -79,18 +95,15 @@ test("Build application.a [dev mode]", (t) => {
assert.directoryDeepEqual(destPath, expectedPath);

// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
t.pass();
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build application.g", (t) => {
const destPath = "./test/tmp/build/application.g/dest";
const expectedPath = "./test/expected/build/application.g/dest";
const expectedPath = path.join("test", "expected", "build", "application.g", "dest");

return builder.build({
tree: applicationGTree,
Expand All @@ -102,18 +115,15 @@ test("Build application.g", (t) => {
// Check for all directories and files
assert.directoryDeepEqual(destPath, expectedPath);
// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build application.g with component preload paths", (t) => {
const destPath = "./test/tmp/build/application.g/dest2";
const expectedPath = "./test/expected/build/application.g/dest";
const expectedPath = path.join("test", "expected", "build", "application.g", "dest");

return builder.build({
tree: applicationGTreeComponentPreloadPaths,
Expand All @@ -125,18 +135,15 @@ test("Build application.g with component preload paths", (t) => {
// Check for all directories and files
assert.directoryDeepEqual(destPath, expectedPath);
// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build application.h", (t) => {
const destPath = "./test/tmp/build/application.h/dest";
const expectedPath = "./test/expected/build/application.h/dest";
const expectedPath = path.join("test", "expected", "build", "application.h", "dest");

return builder.build({
tree: applicationHTree,
Expand All @@ -148,18 +155,15 @@ test("Build application.h", (t) => {
// Check for all directories and files
assert.directoryDeepEqual(destPath, expectedPath);
// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build library.d with copyright from .library file", (t) => {
const destPath = "./test/tmp/build/library.d/dest";
const expectedPath = "./test/expected/build/library.d/dest";
const expectedPath = path.join("test", "expected", "build", "library.d", "dest");

return builder.build({
tree: libraryDTree,
Expand All @@ -172,18 +176,15 @@ test("Build library.d with copyright from .library file", (t) => {
assert.directoryDeepEqual(destPath, expectedPath);

// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
t.pass();
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build library.e with copyright from settings of ui5.yaml", (t) => {
const destPath = "./test/tmp/build/library.e/dest";
const expectedPath = "./test/expected/build/library.e/dest";
const destPath = path.join("test", "tmp", "build", "library.e", "dest");
const expectedPath = path.join("test", "expected", "build", "library.e", "dest");

return builder.build({
tree: libraryETree,
Expand All @@ -196,18 +197,15 @@ test("Build library.e with copyright from settings of ui5.yaml", (t) => {
assert.directoryDeepEqual(destPath, expectedPath);

// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
t.pass();
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build library.h with custom bundles and component-preloads", (t) => {
const destPath = "./test/tmp/build/library.h/dest";
const expectedPath = "./test/expected/build/library.h/dest";
const destPath = path.join("test", "tmp", "build", "library.h", "dest");
const expectedPath = path.join("test", "expected", "build", "library.h", "dest");

return builder.build({
tree: libraryHTree,
Expand All @@ -220,18 +218,15 @@ test("Build library.h with custom bundles and component-preloads", (t) => {
assert.directoryDeepEqual(destPath, expectedPath);

// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
t.pass();
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

test("Build library.i with manifest info taken from .library and library.js", (t) => {
const destPath = "./test/tmp/build/library.i/dest";
const expectedPath = "./test/expected/build/library.i/dest";
const destPath = path.join("test", "tmp", "build", "library.i", "dest");
const expectedPath = path.join("test", "expected", "build", "library.i", "dest");

return builder.build({
tree: libraryITree,
Expand All @@ -244,12 +239,9 @@ test("Build library.i with manifest info taken from .library and library.js", (t
assert.directoryDeepEqual(destPath, expectedPath);

// Check for all file contents
expectedFiles.forEach((expectedFile) => {
const relativeFile = path.relative(expectedPath, expectedFile);
const destFile = path.join(destPath, relativeFile);
assert.fileEqual(destFile, expectedFile);
t.pass();
});
return checkFileContentsIgnoreLineFeeds(expectedFiles, expectedPath, destPath);
}).then(() => {
t.pass();
});
});

Expand Down
18 changes: 9 additions & 9 deletions test/lib/lbt/analyzer/ComponentAnalyzer.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const {test} = require("ava");
const Path = require("path");
const path = require("path");
const ComponentAnalyzer = require("../../../../lib/lbt/analyzer/ComponentAnalyzer");


function createMockPool(path, manifest) {
const expectedPath = Path.join(path, "manifest.json");
function createMockPool(relPath, manifest) {
const expectedPath = path.join(relPath, "manifest.json");
return {
async findResource(name) {
if (name !== expectedPath) {
Expand Down Expand Up @@ -49,7 +49,7 @@ test("routing with routes as array", (t) => {
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo);
return subject.analyze({name: path.join("test", "Component.js")}, mockInfo);
});


Expand Down Expand Up @@ -82,7 +82,7 @@ test("routing with routes as object", (t) => {
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo);
return subject.analyze({name: path.join("test", "Component.js")}, mockInfo);
});

test("routing with route with multiple targets", (t) => {
Expand Down Expand Up @@ -116,7 +116,7 @@ test("routing with route with multiple targets", (t) => {
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo).then( () => {
return subject.analyze({name: path.join("test", "Component.js")}, mockInfo).then( () => {
t.deepEqual(mockInfo.deps, [
"test/view/Master.view.xml",
"test/view/Detail.view.xml"
Expand Down Expand Up @@ -164,7 +164,7 @@ test("routing with targets with local config", (t) => {
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo).then( () => {
return subject.analyze({name: path.join("test", "Component.js")}, mockInfo).then( () => {
t.deepEqual(mockInfo.deps, [
"test/view/Master.view.js",
"test/subview/Detail.view.xml"
Expand Down Expand Up @@ -193,7 +193,7 @@ test("rootView with object", (t) => {
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo).then( () => {
return subject.analyze({name: path.join("test", "Component.js")}, mockInfo).then( () => {
t.deepEqual(mockInfo.deps, [
"test/view/App.view.js",
], "dependencies should be correct");
Expand All @@ -217,7 +217,7 @@ test("rootView with string", (t) => {
};

const subject = new ComponentAnalyzer(mockPool);
return subject.analyze({name: "test/Component.js"}, mockInfo).then( () => {
return subject.analyze({name: path.join("test", "Component.js")}, mockInfo).then( () => {
t.deepEqual(mockInfo.deps, [
"test/view/App.view.xml",
], "dependencies should be correct");
Expand Down
2 changes: 1 addition & 1 deletion test/lib/tasks/bundlers/generateManifestBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const findFiles = (folder) => {
test("Build application.b with manifestBundler", (t) => {
const destPath = "./test/tmp/build/application.b/dest";
const destBundle = destPath + "/manifest-bundle";
const expectedPath = "./test/expected/build/application.b/dest";
const expectedPath = path.join("test", "expected", "build", "application.b", "dest");
const excludedTasks = ["*"];
const includedTasks = ["generateManifestBundle"];

Expand Down