不要怂,就是干,撸起袖子干!

Commit f75d4865 by Jan Aagaard Meier Committed by GitHub

Merge pull request #6589 from sequelize/app-v3-eyor

Appveyor & Codecov setup for v3
2 parents 96dc1f90 d894de15
......@@ -2,7 +2,6 @@ language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs-v1"
- "iojs-v2"
......@@ -17,8 +16,6 @@ env:
- DIALECT=postgres
- DIALECT=postgres-native
- DIALECT=sqlite
- DIALECT=mariadb
- DIALECT=mssql
addons:
postgresql: "9.4"
......@@ -29,19 +26,20 @@ before_script:
- "psql sequelize_test -c 'create extension postgis;' -U postgres"
script:
- "npm test"
- "if [ $COVERAGE ]; then npm run cover && bash <(curl -s https://codecov.io/bash) -f coverage/lcov.info; else npm run test; fi"
matrix:
fast_finish: true
include:
- node_js: "0.10"
env: COVERAGE=true
allow_failures:
- node_js: "0.10"
env: COVERAGE=true
- node_js: "0.12"
env: COVERAGE=true DIALECT=mysql
- node_js: "0.12"
env: COVERAGE=true DIALECT=postgres
- node_js: "0.12"
env: COVERAGE=true DIALECT=postgres-native
- node_js: "0.12"
env: COVERAGE=true DIALECT=sqlite
branches:
only:
- master
- v3
# Sequelize
[![Build Status](https://travis-ci.org/sequelize/sequelize.svg?branch=master)](https://travis-ci.org/sequelize/sequelize) [![Dependency Status](https://david-dm.org/sequelize/sequelize.svg)](https://david-dm.org/sequelize/sequelize) [![Test Coverage](https://codeclimate.com/github/sequelize/sequelize/badges/coverage.svg)](https://codeclimate.com/github/sequelize/sequelize)
[![Build Status](https://travis-ci.org/sequelize/sequelize.svg?branch=v3)](https://travis-ci.org/sequelize/sequelize)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/8xhttm9pxmbmtbwb/branch/v3?svg=true)](https://ci.appveyor.com/project/felixfbecker/sequelize/branch/master)
[![codecov](https://codecov.io/gh/sequelize/sequelize/branch/v3/graph/badge.svg)](https://codecov.io/gh/sequelize/sequelize)
[![Dependency Status](https://david-dm.org/sequelize/sequelize.svg)](https://david-dm.org/sequelize/sequelize)
[![Bountysource](https://www.bountysource.com/badge/team?team_id=955&style=bounties_received)](https://www.bountysource.com/teams/sequelize/issues?utm_source=Sequelize&utm_medium=shield&utm_campaign=bounties_received)
[![Slack Status](http://sequelize-slack.herokuapp.com/badge.svg)](http://sequelize-slack.herokuapp.com)
......
Set-Service sqlbrowser -StartupType auto
Start-Service sqlbrowser
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null
$wmi = New-Object('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer')
$tcp = $wmi.GetSmoObject("ManagedComputer[@Name='${env:computername}']/ServerInstance[@Name='SQL2016']/ServerProtocol[@Name='Tcp']")
$tcp.IsEnabled = $true
$tcp.Alter()
$wmi = New-Object('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer')
$ipall = $wmi.GetSmoObject("ManagedComputer[@Name='${env:computername}']/ServerInstance[@Name='SQL2016']/ServerProtocol[@Name='Tcp']/IPAddress[@Name='IPAll']")
$port = $ipall.IPAddressProperties.Item("TcpDynamicPorts").Value
$config = @{
instanceName = "SQL2016"
host = "localhost"
username = "sa"
password = "Password12!"
port = $port
database = "master"
dialectOptions = @{
requestTimeout = 25000
cryptoCredentialsDetails = @{
ciphers = "RC4-MD5"
}
}
pool = @{
max = 5
idle = 3000
}
}
$json = $config | ConvertTo-Json -Depth 3
# cannot use Out-File because it outputs a BOM
[IO.File]::WriteAllLines((Join-Path $pwd "test\config\mssql.json"), $json)
version: '{build}'
platform:
- x64
services:
- mssql2016
shallow_clone: true
cache:
- node_modules
environment:
matrix:
- {NODE_VERSION: 0.10, DIALECT: mssql}
- {NODE_VERSION: 0.12, DIALECT: mssql, COVERAGE: true}
install:
- ps: Install-Product node $env:NODE_VERSION x64
- ps: |
$pkg = ConvertFrom-Json (Get-Content -Raw package.json)
$pkg.devDependencies.PSObject.Properties.Remove('sqlite3')
$pkg.devDependencies.PSObject.Properties.Remove('pg-native')
ConvertTo-Json $pkg | Out-File package.json -Encoding UTF8
- npm install
build: off
before_test:
- ps: . .\appveyor-setup.ps1
test_script:
- 'IF "%COVERAGE%" == "true" (npm run cover) ELSE (npm test)'
after_test:
- ps: |
$env:PATH = 'C:\Program Files\Git\usr\bin;' + $env:PATH
if (Test-Path env:\COVERAGE) {
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
bash codecov.sh -f "coverage\lcov.info"
}
branches:
only:
- master
- v3
comment:
layout: "header, changes"
behavior: default
......@@ -684,9 +684,9 @@ Sequelize.prototype.import = function(path) {
if (!this.importCache[path]) {
var defineCall = (arguments.length > 1 ? arguments[1] : require(path));
if (typeof defineCall === 'object' && defineCall.__esModule) {
if (typeof defineCall === 'object') {
// Babel/ES6 module compatability
defineCall = defineCall['default'];
defineCall = defineCall.default;
}
this.importCache[path] = defineCall(this, DataTypes);
}
......
......@@ -50,14 +50,13 @@
"wkx": "0.2.0"
},
"devDependencies": {
"babel-core": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"chai": "^3.5.0",
"chai-as-promised": "^5.1.0",
"chai-datetime": "^1.4.0",
"chai-spies": "^0.7.0",
"commander": "^2.6.0",
"continuation-local-storage": "^3.1.4",
"cross-env": "^2.0.1",
"dox": "~0.8.0",
"git": "^0.1.5",
"hints": "^0.2.0",
......@@ -70,6 +69,7 @@
"pg-hstore": "^2.3.1",
"pg-native": "^1.8.0",
"pg-types": "^1.11.0",
"rimraf": "^2.5.4",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0",
"sqlite3": "^3.1.4",
......@@ -88,7 +88,7 @@
],
"main": "index",
"scripts": {
"test": "if [ $COVERAGE ]; then npm run codeclimate; else npm run jshint && npm run teaser && npm run test-unit && npm run test-integration; fi",
"test": "npm run jshint && npm run teaser && npm run test-unit && npm run test-integration",
"test-docker": "docker-compose run sequelize /bin/sh -c \"npm run test-all\"",
"test-docker-unit": "docker-compose run sequelize /bin/sh -c \"npm run test-unit-all\"",
"test-docker-integration": "docker-compose run sequelize /bin/sh -c \"npm run test-integration-all\"",
......@@ -96,46 +96,39 @@
"docs": "node docs/docs-generator.js",
"jshint": "./node_modules/.bin/jshint lib test",
"teaser": "echo ''; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\"; echo '# Running tests for '$DIALECT' #'; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\";echo '';",
"test-unit": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter spec 'test/unit/**/*.js'",
"test-unit-mysql": "DIALECT=mysql npm run test-unit",
"test-unit-postgres": "DIALECT=postgres npm run test-unit",
"test-unit-postgres-native": "DIALECT=postgres-native npm run test-unit",
"test-unit-mariadb": "DIALECT=mariadb npm run test-unit",
"test-unit-sqlite": "DIALECT=sqlite npm run test-unit",
"test-unit-mssql": "DIALECT=mssql npm run test-unit",
"test-unit": "mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec \"test/unit/**/*.js\"",
"test-unit-mysql": "cross-env DIALECT=mysql npm run test-unit",
"test-unit-postgres": "cross-env DIALECT=postgres npm run test-unit",
"test-unit-postgres-native": "cross-env DIALECT=postgres-native npm run test-unit",
"test-unit-mariadb": "cross-env DIALECT=mariadb npm run test-unit",
"test-unit-sqlite": "cross-env DIALECT=sqlite npm run test-unit",
"test-unit-mssql": "cross-env DIALECT=mssql npm run test-unit",
"test-unit-all": "npm run test-unit-mysql && npm run test-unit-postgres && npm run test-unit-postgres-native && npm run test-unit-mssql && npm run test-unit-sqlite && npm run test-unit-mariadb",
"test-integration": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter spec --grep \"$GREP\" 'test/integration/**/*.test.js'",
"test-integration-mysql": "DIALECT=mysql npm run test-integration",
"test-integration-postgres": "DIALECT=postgres npm run test-integration",
"test-integration-postgres-native": "DIALECT=postgres-native npm run test-integration",
"test-integration-mariadb": "DIALECT=mariadb npm run test-integration",
"test-integration-sqlite": "DIALECT=sqlite npm run test-integration",
"test-integration-mssql": "DIALECT=mssql npm run test-integration",
"test-integration": "mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec \"test/integration/**/*.test.js\"",
"test-integration-mysql": "cross-env DIALECT=mysql npm run test-integration",
"test-integration-postgres": "cross-env DIALECT=postgres npm run test-integration",
"test-integration-postgres-native": "cross-env DIALECT=postgres-native npm run test-integration",
"test-integration-mariadb": "cross-env DIALECT=mariadb npm run test-integration",
"test-integration-sqlite": "cross-env DIALECT=sqlite npm run test-integration",
"test-integration-mssql": "cross-env DIALECT=mssql npm run test-integration",
"test-integration-all": "npm run test-integration-mysql && npm run test-integration-postgres && npm run test-integration-postgres-native && npm run test-integration-mssql && npm run test-integration-sqlite && npm run test-integration-mariadb",
"test-mysql": "DIALECT=mysql npm test",
"test-sqlite": "DIALECT=sqlite npm test",
"test-postgres": "DIALECT=postgres npm test",
"test-mysql": "cross-env DIALECT=mysql npm test",
"test-sqlite": "cross-env DIALECT=sqlite npm test",
"test-postgres": "cross-env DIALECT=postgres npm test",
"test-pgsql": "npm run test-postgres",
"test-postgres-native": "DIALECT=postgres-native npm test",
"test-postgres-native": "cross-env DIALECT=postgres-native npm test",
"test-postgresn": "npm run test-postgres-native",
"test-mariadb": "DIALECT=mariadb npm test",
"test-mssql": "DIALECT=mssql npm test",
"test-mariadb": "cross-env DIALECT=mariadb npm test",
"test-mssql": "cross-env DIALECT=mssql npm test",
"test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mariadb && npm run test-mssql",
"cover": "rm -rf coverage && npm run teaser && COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/integration/**/*.test.js'",
"cover-mysql": "DIALECT=mysql npm run cover && mv coverage coverage-mysql",
"cover-sqlite": "DIALECT=sqlite npm run cover && mv coverage coverage-sqlite",
"cover-postgres": "DIALECT=postgres npm run cover && mv coverage coverage-postgres",
"cover-postgres-native": "DIALECT=postgres-native npm run cover && mv coverage coverage-postgres-native",
"cover-mariadb": "DIALECT=mariadb npm run cover && mv coverage coverage-mariadb",
"cover-mssql": "DIALECT=mssql npm run cover && mv coverage coverage-mssql",
"cover-all": "npm run cover-mysql && npm run cover-postgres && npm run cover-postgres-native && npm run cover-mssql && npm run cover-sqlite && npm run cover-mariadb && npm run merge-coverage",
"merge-coverage": "rm -rf coverage && mkdir coverage && ./node_modules/.bin/lcov-result-merger 'coverage-*/lcov.info' 'coverage/lcov.info'",
"codeclimate-send": "npm install -g codeclimate-test-reporter && CODECLIMATE_REPO_TOKEN=ce835a510bbf423a5ab5400a9bdcc2ec2d189d840b31657c6ee7cb9916b161d6 codeclimate-test-reporter < coverage/lcov.info",
"codeclimate": "npm run cover-all && npm run codeclimate-send",
"cover": "rimraf coverage && npm run teaser && npm run cover-unit && npm run cover-integration && npm run merge-coverage",
"cover-integration": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 60000 --ui tdd \"test/integration/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/integration.info')\"",
"cover-unit": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 30000 --ui tdd \"test/unit/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/unit.info')\"",
"merge-coverage": "lcov-result-merger \"coverage/*.info\" \"coverage/lcov.info\"",
"sscce": "docker-compose run sequelize /bin/sh -c \"node sscce.js\"",
"sscce-mysql": "DIALECT=mysql npm run sscce",
"sscce-postgres": "DIALECT=postgres npm run sscce",
"sscce-sqlite": "DIALECT=sqlite npm run sscce"
"sscce-mysql": "cross-env DIALECT=mysql npm run sscce",
"sscce-postgres": "cross-env DIALECT=postgres npm run sscce",
"sscce-sqlite": "cross-env DIALECT=sqlite npm run sscce"
},
"engines": {
"node": ">=0.6.21"
......
'use strict';
var fs = require('fs');
var mssqlConfig;
try {
mssqlConfig = JSON.parse(fs.readFileSync(__dirname + '/mssql.json', 'utf8'));
} catch (e) {
// ignore
}
module.exports = {
username: process.env.SEQ_USER || 'root',
password: process.env.SEQ_PW || null,
......@@ -14,15 +22,11 @@ module.exports = {
return parseInt(Math.random() * 999, 10);
},
mssql: {
database: process.env.SEQ_MSSQL_DB || process.env.SEQ_DB || (function () {
var db = 'sequelize-test-' + ~~(Math.random() * 100);
console.log('Using database: ', db);
return db;
}()),
mssql: mssqlConfig || {
database: process.env.SEQ_MSSQL_DB || process.env.SEQ_DB || 'sequelize_test',
username: process.env.SEQ_MSSQL_USER || process.env.SEQ_USER || 'sequelize',
password: process.env.SEQ_MSSQL_PW || process.env.SEQ_PW || 'nEGkLma26gXVHFUAHJxcmsrK',
host: process.env.SEQ_MSSQL_HOST || process.env.SEQ_HOST || 'mssql.sequelizejs.com',
password: process.env.SEQ_MSSQL_PW || process.env.SEQ_PW || null,
host: process.env.SEQ_MSSQL_HOST || process.env.SEQ_HOST || '127.0.0.1',
port: process.env.SEQ_MSSQL_PORT || process.env.SEQ_PORT || 11433,
pool: {
maxConnections: process.env.SEQ_MSSQL_POOL_MAX || process.env.SEQ_POOL_MAX || 5,
......
export default function(sequelize, DataTypes) {
'use strict';
exports.default = function(sequelize, DataTypes) {
return sequelize.define('Project' + parseInt(Math.random() * 9999999999999999), {
name: DataTypes.STRING
});
......
......@@ -7,12 +7,9 @@ var chai = require('chai')
, Support = require(__dirname + '/support')
, dialect = Support.getTestDialect()
, Sequelize = Support.Sequelize
, sqlite3 = require('sqlite3')
, fs = require('fs')
, path = require('path');
describe(Support.getTestDialectTeaser('Configuration'), function() {
describe('Connections problems should fail with a nice message', function() {
it('when we don\'t have the correct server details', function() {
......@@ -149,6 +146,7 @@ describe(Support.getTestDialectTeaser('Configuration'), function() {
});
if (dialect === 'sqlite') {
var sqlite3 = require('sqlite3');
it('should respect READONLY / READWRITE connection modes', function() {
var p = path.join(__dirname, '../tmp', 'foo.sqlite');
var createTableFoo = 'CREATE TABLE foo (faz TEXT);';
......
......@@ -27,15 +27,25 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() {
describe('dropAllTables', function() {
it('should drop all tables', function() {
function filterMSSQLDefault(tableNames) {
return tableNames.filter(function (t) {
return t.tableName !== 'spt_values';
});
}
var self = this;
return this.queryInterface.dropAllTables().then(function() {
return self.queryInterface.showAllTables().then(function(tableNames) {
// MSSQL include spt_values table which is system defined, hence cant be dropped
tableNames = filterMSSQLDefault(tableNames);
expect(tableNames).to.be.empty;
return self.queryInterface.createTable('table', { name: DataTypes.STRING }).then(function() {
return self.queryInterface.showAllTables().then(function(tableNames) {
tableNames = filterMSSQLDefault(tableNames);
expect(tableNames).to.have.length(1);
return self.queryInterface.dropAllTables().then(function() {
return self.queryInterface.showAllTables().then(function(tableNames) {
// MSSQL include spt_values table which is system defined, hence cant be dropped
tableNames = filterMSSQLDefault(tableNames);
expect(tableNames).to.be.empty;
});
});
......
......@@ -14,7 +14,6 @@ var chai = require('chai')
, moment = require('moment')
, Transaction = require(__dirname + '/../../lib/transaction')
, sinon = require('sinon')
, babel = require('babel-core')
, fs = require('fs')
, current = Support.sequelize;
......@@ -1088,7 +1087,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
'password authentication failed for user "bar"'
].indexOf(err.message.trim()) !== -1);
} else if (dialect === 'mssql') {
expect(err.message).to.match(/.*ECONNREFUSED.*/);
expect(err.message).to.equal('Login failed for user \'bar\'.');
} else {
expect(err.message.toString()).to.match(/.*Access\ denied.*/);
}
......@@ -1252,14 +1251,9 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
expect(Project).to.exist;
});
it('imports a dao definition from a file compiled with babel', function () {
var es6project = babel.transformFileSync(__dirname + '/assets/es6project.es6', {
presets: ['es2015']
}).code;
fs.writeFileSync(__dirname + '/assets/es6project.js', es6project);
it('imports a dao definition with a default export', function () {
var Project = this.sequelize.import(__dirname + '/assets/es6project');
expect(Project).to.exist;
});
after(function(){
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!