Skip to content

Commit

Permalink
Merge branch 'master' into internals
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Dec 30, 2016
2 parents ce6c2a3 + 1f9a5c2 commit 5913e6c
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 18 deletions.
20 changes: 20 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Test against this version of Node.js
environment:
nodejs_version: "7"

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install

build: off

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test
9 changes: 5 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Adds more functions the the internal Danger GitHub client - orta
* Infrastructure work to allow Peril to run a Dangerfile - orta
* Upgrade outdated ESLint packages - macklinu
* Enhance Windows OS compatibility - kwonoj

### 0.7.1

Expand All @@ -20,7 +21,7 @@

* Uses `jest-transform` and `jest-runtime` to eval and apply babel transforms.

This does two things, makes it feasible to do [hosted-danger](https://github.com/danger/peril) and
This does two things, makes it feasible to do [hosted-danger](https://github.com/danger/peril) and
makes it possible to write your Dangerfile in a way that's consistent with the rest of your JavaScript. - orta

* Add tests directory to .npmignore - macklinu
Expand All @@ -33,7 +34,7 @@

### 0.6.9

* Makes `babel-polyfill` a direct dependency, this is because it is actually an implicit dependency in the app. I'm not sure how I feel about this, I guess if we use a part of it in the babel translation of a user's Dangerfile them I'm OK with it. - orta
* Makes `babel-polyfill` a direct dependency, this is because it is actually an implicit dependency in the app. I'm not sure how I feel about this, I guess if we use a part of it in the babel translation of a user's Dangerfile them I'm OK with it. - orta

### 0.6.6 - 0.6.7 - 0.6.8

Expand All @@ -48,7 +49,7 @@

* The env vars `DANGER_TEST_REPO` and `DANGER_TEST_PR` will allow you initialize the FakeCI with a repo of your choice. See README.md for more info
* Improved error messaging around not including a `DANGER_GITHUB_API_TOKEN` in the ENV - nsfmc / orta
* Adds support for getting the diff for a specific file from git: e.g.
* Adds support for getting the diff for a specific file from git: e.g.

```js
// Politely ask for their name on the entry too
Expand All @@ -62,7 +63,7 @@ if (changelogDiff && changelogDiff.indexOf(contributorName) === -1) {
### 0.6.3

* Does not break commonmark on GitHub - orta
* upgrades to flow 0.35.0 and fixes associated type errors in covariant/invariant interfaces - nsfmc
* upgrades to flow 0.35.0 and fixes associated type errors in covariant/invariant interfaces - nsfmc
* omits flow requirement for new test files - nsfmc
* adds support for circleci - nsfmc
* defines CISource properties in flow as read-only - nsfmc
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"eslint-plugin-flowtype": "^2.29.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.0",
"flow-bin": "^0.35.0",
"flow-bin": "^0.37.4",
"in-publish": "^2.0.0",
"jest": "^18.0.0"
},
Expand Down
File renamed without changes.
7 changes: 5 additions & 2 deletions source/platforms/_tests/GitHub.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { GitHub } from "../GitHub"
import Fake from "../../ci_source/Fake"
import { readFileSync } from "fs"
import { resolve } from "path"
import os from "os"
import type { GitDSL } from "../../dsl/GitDSL"
const fixtures = resolve(__dirname, "fixtures")
const EOL = os.EOL

// Gets a mocked out GitHub class for checking a get path
const mockGitHubWithGetForPath = (expectedPath): GitHub => {
Expand Down Expand Up @@ -81,10 +83,11 @@ describe("with fixtured data", () => {
expect(gitDSL.deleted_files).toEqual(["lib/components/artist/related_artists/index.js", "lib/components/artist/related_artists/related_artist.js", "lib/components/gene/about_gene.js"])
})

// sorry windows users - I guess this test will fail for you
it("shows the diff for a specific file", async () => {
const expected = ` - [dev] Updates Flow to 0.32 - orta${EOL} - [dev] Updates React to 0.34 - orta${EOL} - [dev] Turns on \"keychain sharing\" to fix a keychain bug in sim - orta${EOL}+- GeneVC now shows about information, and trending artists - orta${EOL} ${EOL} ### 1.1.0-beta.2${EOL} `;
const gitDSL:GitDSL = await github.getReviewDiff()
expect(gitDSL.diffForFile("CHANGELOG.md")).toEqual(` - [dev] Updates Flow to 0.32 - orta\n - [dev] Updates React to 0.34 - orta\n - [dev] Turns on \"keychain sharing\" to fix a keychain bug in sim - orta\n+- GeneVC now shows about information, and trending artists - orta\n \n ### 1.1.0-beta.2\n `)

expect(gitDSL.diffForFile("CHANGELOG.md")).toEqual(expected)
})
})
})
4 changes: 3 additions & 1 deletion source/runner/DangerfileRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export async function createDangerfileRuntimeEnvironment(dangerfileContext: Dang
moduleFileExtensions: ["js"],
transform: [["js$", "babel-jest"]],
transformIgnorePatterns: [],
cache: null
cache: null,
testRegex: "",
testPathDirs: [process.cwd()]
}

const environment: Environment = new NodeEnvironment(config)
Expand Down
12 changes: 5 additions & 7 deletions source/runner/_tests/DangerRunner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("with fixtures", () => {
it("handles a blank Dangerfile", async () => {
const context = await setupDangerfileContext()
const runtime = await createDangerfileRuntimeEnvironment(context)
const results = await runDangerfileEnvironment(`${fixtures}/__DangerfileEmpty.js`, runtime)
const results = await runDangerfileEnvironment(resolve(fixtures, "__DangerfileEmpty.js"), runtime)

expect(results).toEqual({
fails: [],
Expand All @@ -38,11 +38,10 @@ describe("with fixtures", () => {
})
})

it("handles a full set of messages", async () => {
it("handles a full set of messages", async () => {
const context = await setupDangerfileContext()
const runtime = await createDangerfileRuntimeEnvironment(context)

const results = await runDangerfileEnvironment(`${fixtures}/__DangerfileFullMessages.js`, runtime)
const results = await runDangerfileEnvironment(resolve(fixtures, "__DangerfileFullMessages.js"), runtime)

expect(results).toEqual({
fails: [{"message": "this is a failure"}],
Expand All @@ -57,7 +56,7 @@ describe("with fixtures", () => {
const runtime = await createDangerfileRuntimeEnvironment(context)

try {
await runDangerfileEnvironment(`${fixtures}/__DangerfileBadSyntax.js`, runtime)
await runDangerfileEnvironment(resolve(fixtures, "__DangerfileBadSyntax.js"), runtime)
throw new Error("Do not get to this")
}
catch (e) {
Expand All @@ -69,7 +68,6 @@ describe("with fixtures", () => {
it("handles relative imports correctly", async () => {
const context = await setupDangerfileContext()
const runtime = await createDangerfileRuntimeEnvironment(context)

await runDangerfileEnvironment(`${fixtures}/__DangerfileImportRelative.js`, runtime)
await runDangerfileEnvironment(resolve(fixtures, "__DangerfileImportRelative.js"), runtime)
})
})
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1370,9 +1370,9 @@ flat-cache@^1.2.1:
graceful-fs "^4.1.2"
write "^0.2.1"

flow-bin@^0.35.0:
version "0.35.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.35.0.tgz#63d4eb9582ce352541be98e6a424503217141b07"
flow-bin@^0.37.4:
version "0.37.4"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.37.4.tgz#3d8da2ef746e80e730d166e09040f4198969b76b"

for-in@^0.1.5:
version "0.1.6"
Expand Down

0 comments on commit 5913e6c

Please sign in to comment.