Skip to content

Commit

Permalink
initial upgrade of all specs to gallinago
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Apr 24, 2021
1 parent c86e167 commit b633e22
Show file tree
Hide file tree
Showing 53 changed files with 1,032 additions and 734 deletions.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ $ yarn test
Below are some tips to help with running / debugging tests:
- `describe.only` / `it.only`: only runs this block
- `xdescribe` / `xit`: dont run this block
- Uncomment `setup.teardownTestBed()` in a case to see the build output without it getting cleaned up post test run
- Use `new TestBed(true)` get debug output from Greenwood when running tests
- Uncomment `runner.teardown()` in a case to see the build output without it getting cleaned up post test run
- Use `new Runner(true)` get debug output from Greenwood when running tests

> **PLEASE DO NOT COMMIT ANY OF THESE ABOVE CHANGES THOUGH**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
const path = require('path');
const runSmokeTest = require('../../../../../test/smoke-test');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
Expand All @@ -24,7 +25,7 @@ describe('Build Greenwood With: ', function() {
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
before(function() {
this.context = {
publicDir: path.join(outputPath, 'public')
};
Expand All @@ -33,14 +34,7 @@ describe('Build Greenwood With: ', function() {

describe(LABEL, function() {
before(async function() {
await runner.setup(outputPath, [{
source: path.join(process.cwd(), 'node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js'),
destination: path.join(outputPath, 'node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js')
}, {
source: path.join(process.cwd(), 'node_modules/es-module-shims/dist/es-module-shims.js'),
destination: path.join(outputPath, 'node_modules/es-module-shims/dist/es-module-shims.js')
}]);

await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,35 @@
* Greenwood default
*/
const expect = require('chai').expect;
const TestBed = require('../../../../../test/test-bed');
const path = require('path');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
let setup;
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();
await setup.setupTestBed(__dirname);
before(function() {
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe('Custom Configuration with a bad value for mode', function() {
it('should throw an error that provided mode is not valid', async function() {
try {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
} catch (err) {
expect(err).to.contain('Error: provided mode "loremipsum" is not supported. Please use one of: ssg, mpa.');
}
});
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,35 @@
* Greenwood default
*/
const expect = require('chai').expect;
const TestBed = require('../../../../../test/test-bed');
const path = require('path');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
let setup;
describe.only('Build Greenwood With: ', function() {
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();
await setup.setupTestBed(__dirname);
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe('Custom Configuration with a bad value for optimization', function() {
it('should throw an error that provided optimization is not valid', async function() {
try {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
} catch (err) {
expect(err).to.contain('Error: provided optimization "loremipsum" is not supported. Please use one of: default, none, static, inline.');
}
});
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,35 @@
* Greenwood default
*/
const expect = require('chai').expect;
const TestBed = require('../../../../../test/test-bed');
const path = require('path');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
let setup;
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();
await setup.setupTestBed(__dirname);
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe('Custom Configuration with a bad value for Title', function() {
it('should throw an error that title must be a string', async function() {
try {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
} catch (err) {
expect(err).to.contain('greenwood.config.js title must be a string');
}
});
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,35 @@
* Greenwood default
*/
const expect = require('chai').expect;
const TestBed = require('../../../../../test/test-bed');
const path = require('path');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
let setup;
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();
await setup.setupTestBed(__dirname);
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe('Custom Configuration with a bad value (absolute path) for Workspace', function() {
it('should throw an error that workspace path must exist', async function() {
try {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
} catch (err) {
expect(err).to.contain('greenwood.config.js workspace doesn\'t exist!');
}
});
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,35 @@
* Greenwood default
*/
const expect = require('chai').expect;
const TestBed = require('../../../../../test/test-bed');
const path = require('path');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
let setup;
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();
await setup.setupTestBed(__dirname);
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe('Custom Configuration with a bad value for Workspace', function() {
it('should throw an error that workspace path must be a string', async function() {
try {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
} catch (err) {
expect(err).to.contain('greenwood.config.js workspace path must be a string');
}
});
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,26 @@ const { JSDOM } = require('jsdom');
const path = require('path');
const expect = require('chai').expect;
const runSmokeTest = require('../../../../../test/smoke-test');
const TestBed = require('../../../../../test/test-bed');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
const LABEL = 'Custom Markdown Configuration and Default Workspace';
let setup;
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();

this.context = await setup.setupTestBed(__dirname);
before(function() {
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe(LABEL, function() {
before(async function() {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
});

runSmokeTest(['public', 'index'], LABEL);
Expand Down Expand Up @@ -77,7 +82,7 @@ describe('Build Greenwood With: ', function() {
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,29 @@
* index.md
*/
const { JSDOM } = require('jsdom');
const path = require('path');
const expect = require('chai').expect;
const TestBed = require('../../../../../test/test-bed');
const path = require('path');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
const LABEL = 'Custom Markdown Configuration and Custom Workspace';
let setup;
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();

this.context = await setup.setupTestBed(__dirname);
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe(LABEL, function() {

before(async function() {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
});

describe('Custom Markdown Presets', function() {
Expand All @@ -58,7 +63,7 @@ describe('Build Greenwood With: ', function() {
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,21 @@ const { JSDOM } = require('jsdom');
const path = require('path');
const expect = require('chai').expect;
const runSmokeTest = require('../../../../../test/smoke-test');
const TestBed = require('../../../../../test/test-bed');
const { getSetupFiles } = require('../../../../../test/utils');
const Runner = require('gallinago').Runner;

describe('Build Greenwood With: ', function() {
const LABEL = 'Custom Meta Configuration and Nested Workspace';
const meta = greenwoodConfig.meta;
let setup;
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js');
const outputPath = path.join(__dirname, 'output');
let runner;

before(async function() {
setup = new TestBed();
this.context = await setup.setupTestBed(__dirname);
before(function() {
this.context = {
publicDir: path.join(outputPath, 'public')
};
runner = new Runner();
});

describe(LABEL, function() {
Expand All @@ -57,7 +62,8 @@ describe('Build Greenwood With: ', function() {
};

before(async function() {
await setup.runGreenwoodCommand('build');
await runner.setup(outputPath, getSetupFiles(outputPath));
await runner.runCommand(cliPath, 'build');
});

runSmokeTest(['public', 'index'], LABEL);
Expand Down Expand Up @@ -168,7 +174,7 @@ describe('Build Greenwood With: ', function() {
});

after(function() {
setup.teardownTestBed();
runner.teardown();
});

});
Loading

0 comments on commit b633e22

Please sign in to comment.