Skip to content

Commit

Permalink
* First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
francoislg committed Oct 18, 2017
1 parent 74f1dd8 commit ec2c9f9
Show file tree
Hide file tree
Showing 31 changed files with 12,500 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ typings/
# dotenv environment variables file
.env

/bin
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# search-ui-tests

Testing framework for the Coveo JavaScript Search Framework

## Usage

Include the compiled `bin/js/CoveoJsSearchTests.js` file in your test configuration.

## Modules

### Mock

Allows to create mocks of components required for the framework.

### Fake

Allows to create fake objects like results, events and fields.

### Simulate

Allows to simulate some actions in the framework or in the browser.
43 changes: 43 additions & 0 deletions declaration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const exec = require("child-process-promise").exec;
const DtsBundle = require("dts-bundle");
const fs = require("fs");

const tempFolder = "./bin/temp";
const destFolder = "./bin/ts";
const dtsFileName = "coveo-search-ui-tests";

function Bundle() {
return DtsBundle.bundle({
name: dtsFileName,
// Relative to the "main" file, ¯\_(ツ)_/¯
main: `${tempFolder}/Index.d.ts`
});
}

function BuildDeclarationFiles() {
return exec(
`tsc --declaration --outDir ${tempFolder} --declarationDir ${tempFolder}`
);
}

function CopyDtsInFolder() {
return new Promise((resolve, reject) => {
if (!fs.existsSync(destFolder)) {
fs.mkdirSync(destFolder);
}
const stream = fs
.createReadStream(`${tempFolder}/${dtsFileName}.d.ts`)
.pipe(fs.createWriteStream(`${destFolder}/${dtsFileName}.d.ts`));
stream.on("close", resolve);
stream.on("error", reject);
});
}

function RemoveTempFolder() {
return exec(`rm -rf ${tempFolder}`);
}

BuildDeclarationFiles()
.then(Bundle)
.then(CopyDtsInFolder)
.then(RemoveTempFolder);
Loading

0 comments on commit ec2c9f9

Please sign in to comment.