initial commit

This commit is contained in:
tmshv committed 2014-02-12 12:36:59 +04:00
commit d3fcd7f10c
3159 files changed
+349702

No files matched your search

+1
View File
@@ -0,0 +1 @@
should.js
+29
View File
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<JSCodeStyleSettings>
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
</JSCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JavaScript">
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
+7
View File
@@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>
+7
View File
@@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{Node.js Dependencies for should.js}" />
</component>
</project>
+68
View File
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSHintConfiguration" version="2.3.0" use-config-file="false">
<option bitwise="false" />
<option camelcase="false" />
<option curly="false" />
<option eqeqeq="false" />
<option es3="false" />
<option forin="true" />
<option freeze="false" />
<option immed="true" />
<option newcap="false" />
<option noarg="true" />
<option noempty="true" />
<option nonew="true" />
<option plusplus="false" />
<option undef="true" />
<option strict="false" />
<option trailing="false" />
<option latedef="false" />
<option unused="true" />
<option quotmark="false" />
<option asi="false" />
<option boss="false" />
<option debug="false" />
<option eqnull="true" />
<option esnext="false" />
<option evil="false" />
<option expr="false" />
<option funcscope="false" />
<option globalstrict="false" />
<option iterator="false" />
<option lastsemic="false" />
<option laxbreak="false" />
<option laxcomma="false" />
<option loopfunc="false" />
<option moz="false" />
<option multistr="false" />
<option notypeof="false" />
<option proto="false" />
<option scripturl="false" />
<option smarttabs="false" />
<option shadow="false" />
<option sub="false" />
<option supernew="false" />
<option validthis="false" />
<option browser="true" />
<option couch="false" />
<option devel="false" />
<option dojo="false" />
<option jquery="false" />
<option mootools="false" />
<option node="true" />
<option nonstandard="false" />
<option phantom="false" />
<option prototypejs="false" />
<option rhino="false" />
<option worker="false" />
<option wsh="false" />
<option yui="false" />
<option nomen="false" />
<option onevar="false" />
<option passfail="false" />
<option white="false" />
<option maxerr="50" />
</component>
</project>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Node.js Dependencies for should.js" type="javaScript">
<properties>
<sourceFilesUrls>
<item url="file://$PROJECT_DIR$/node_modules" />
</sourceFilesUrls>
</properties>
<CLASSES>
<root url="file://$PROJECT_DIR$/node_modules" />
</CLASSES>
<SOURCES />
</library>
</component>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" />
</project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/should.js.iml" filepath="$PROJECT_DIR$/.idea/should.js.iml" />
</modules>
</component>
</project>
+5
View File
@@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Node.js Dependencies for should.js" level="project" />
</component>
</module>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+763
View File
@@ -0,0 +1,763 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="a3a0dfb9-27f8-4073-9692-e69b1293acba" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/History.md" afterPath="$PROJECT_DIR$/History.md" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/package.json" afterPath="$PROJECT_DIR$/package.json" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/should.min.js" afterPath="$PROJECT_DIR$/should.min.js" />
</list>
<ignored path="should.js.iws" />
<ignored path=".idea/workspace.xml" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="should.js" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="util.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/util.js">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="2" selection-start="321" selection-end="321" vertical-scroll-proportion="0.0" vertical-offset="266" max-vertical-offset="2356">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="string.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/ext/string.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="97" selection-end="97" vertical-scroll-proportion="0.0" vertical-offset="114" max-vertical-offset="456">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="should.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/should.js">
<provider selected="true" editor-type-id="text-editor">
<state line="138" column="44" selection-start="3022" selection-end="3022" vertical-scroll-proportion="0.0" vertical-offset="2622" max-vertical-offset="3325">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="jquery.test.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/ext/browser/jquery.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="202" column="0" selection-start="5749" selection-end="5749" vertical-scroll-proportion="0.0" vertical-offset="6308" max-vertical-offset="7676">
<folding>
<marker date="1390468484000" expanded="false" signature="1894:1915" placeholder="..." />
<marker date="1390468484000" expanded="false" signature="2040:2062" placeholder="..." />
<marker date="1390468484000" expanded="false" signature="2168:2191" placeholder="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="jquery.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/ext/browser/jquery.js">
<provider selected="true" editor-type-id="text-editor">
<state line="95" column="16" selection-start="3293" selection-end="3293" vertical-scroll-proportion="0.0" vertical-offset="1463" max-vertical-offset="4446">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Makefile" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Makefile">
<provider selected="true" editor-type-id="text-editor">
<state line="9" column="20" selection-start="275" selection-end="275" vertical-scroll-proportion="0.0" vertical-offset="171" max-vertical-offset="285">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="History.md" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/History.md">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="0" selection-start="281" selection-end="281" vertical-scroll-proportion="0.4801444" vertical-offset="0" max-vertical-offset="4332">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="package.json" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state line="2" column="21" selection-start="108" selection-end="108" vertical-scroll-proportion="-1.52" vertical-offset="0" max-vertical-offset="418">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Readme.md" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Readme.md">
<provider selected="true" editor-type-id="text-editor">
<state line="69" column="0" selection-start="1898" selection-end="1898" vertical-scroll-proportion="0.0" vertical-offset="703" max-vertical-offset="12350">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="dot.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/node_modules/mocha/lib/reporters/dot.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1273">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GitLogSettings">
<option name="myDateState">
<MyDateState />
</option>
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/lib/ext/chain.js" />
<option value="$PROJECT_DIR$/lib/ext/bool.js" />
<option value="$PROJECT_DIR$/lib/ext/eql.js" />
<option value="$PROJECT_DIR$/lib/ext/number.js" />
<option value="$PROJECT_DIR$/test/ext/bool.test.js" />
<option value="$PROJECT_DIR$/Makefile" />
<option value="$PROJECT_DIR$/test/util.js" />
<option value="$PROJECT_DIR$/test/should.test.js" />
<option value="$PROJECT_DIR$/test/ext/number.test.js" />
<option value="$PROJECT_DIR$/test.js" />
<option value="$PROJECT_DIR$/lib/ext/type.js" />
<option value="$PROJECT_DIR$/lib/ext/assert.js" />
<option value="$PROJECT_DIR$/Readme.md" />
<option value="$PROJECT_DIR$/test/ext/property.test.js" />
<option value="$PROJECT_DIR$/lib/util.js" />
<option value="$PROJECT_DIR$/lib/ext/string.js" />
<option value="$PROJECT_DIR$/lib/ext/deprecated.js" />
<option value="$PROJECT_DIR$/lib/ext/error.js" />
<option value="$PROJECT_DIR$/lib/ext/http.js" />
<option value="$PROJECT_DIR$/lib/ext/property.js" />
<option value="$PROJECT_DIR$/lib/ext/match.js" />
<option value="$PROJECT_DIR$/lib/should.js" />
<option value="$PROJECT_DIR$/test/test.test.js" />
<option value="$PROJECT_DIR$/node_modules/mocha/lib/reporters/base.js" />
<option value="$PROJECT_DIR$/test/ext/browser/jquery.test.js" />
<option value="$PROJECT_DIR$/lib/ext/browser/jquery.js" />
<option value="$PROJECT_DIR$/package.json" />
<option value="$PROJECT_DIR$/History.md" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="y" value="22" />
<option name="width" value="1920" />
<option name="height" value="970" />
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>Bash</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="1" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents ProjectPane="true" />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ext" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ext" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="browser" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="lib" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="lib" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ext" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="should.js" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="lib" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ext" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="browser" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="options.splitter.main.proportions" value="0.3" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="options.lastSelected" value="Settings.JavaScript.Linters.JSHint" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="FullScreen" value="false" />
<property name="DefaultHtmlFileTemplate" value="Html5" />
<property name="options.splitter.details.proportions" value="0.2" />
<property name="options.searchVisible" value="true" />
<property name="SearchEverywhereHistory" value="" />
<property name="LayoutCode.rearrangeEntriesJavaScript" value="false" />
<property name="LayoutCode.rearrangeEntries" value="false" />
<property name="recentsLimit" value="5" />
</component>
<component name="RunManager">
<configuration default="true" type="DartUnitRunConfigurationType" factoryName="DartUnit">
<option name="VMOptions" />
<option name="arguments" />
<option name="filePath" />
<option name="scope" value="ALL" />
<option name="testName" />
<method />
</configuration>
<configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
<option name="VMOptions" />
<option name="arguments" />
<option name="filePath" />
<option name="name" value="Dart" />
<option name="saveOutputToFile" value="false" />
<option name="showConsoleOnStdErr" value="false" />
<option name="showConsoleOnStdOut" value="false" />
<method />
</configuration>
<configuration default="true" type="JSTestDriver:ConfigurationType" factoryName="JsTestDriver">
<setting name="configLocationType" value="CONFIG_FILE" />
<setting name="settingsFile" value="" />
<setting name="serverType" value="INTERNAL" />
<setting name="preferredDebugBrowser" value="CHROME" />
<method />
</configuration>
<configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" singleton="true" config-file="">
<envs />
<method />
</configuration>
<configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug" singleton="true">
<method />
</configuration>
<configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" working-dir="">
<browser start="false" url="" with-js-debugger="false" />
<method />
</configuration>
<list size="0" />
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false" SSL_PROTOCOLS="sslv3">
<option name="USER" value="" />
<option name="PASSWORD" value="" />
<option name="mySSHConnectionTimeout" value="30000" />
<option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" />
<option name="MERGE_DRY_RUN" value="false" />
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
<option name="FORCE_UPDATE" value="false" />
<option name="IGNORE_EXTERNALS" value="false" />
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="a3a0dfb9-27f8-4073-9692-e69b1293acba" name="Default" comment="" />
<created>1378708904520</created>
<updated>1378708904520</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="22" width="1920" height="970" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298969" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.33863637" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.28221512" sideWeight="0.6710059" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Mongo Runner" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3289941" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39977092" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USERS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="myTodoPanelSettings">
<TodoPanelSettings />
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/lib/ext/assert.js">
<provider selected="true" editor-type-id="text-editor">
<state line="33" column="12" selection-start="681" selection-end="681" vertical-scroll-proportion="0.0" vertical-offset="627" max-vertical-offset="1178" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ext/property.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="159" column="14" selection-start="4836" selection-end="4836" vertical-scroll-proportion="0.0" vertical-offset="2664" max-vertical-offset="3743" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/util.js">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="2" selection-start="321" selection-end="321" vertical-scroll-proportion="0.0" vertical-offset="266" max-vertical-offset="2356">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/string.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="97" selection-end="97" vertical-scroll-proportion="0.0" vertical-offset="114" max-vertical-offset="456">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/http.js">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="46" selection-start="194" selection-end="194" vertical-scroll-proportion="0.0" vertical-offset="152" max-vertical-offset="722" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/property.js">
<provider selected="true" editor-type-id="text-editor">
<state line="183" column="33" selection-start="5102" selection-end="5102" vertical-scroll-proportion="0.0" vertical-offset="3477" max-vertical-offset="4180" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/error.js">
<provider selected="true" editor-type-id="text-editor">
<state line="50" column="2" selection-start="1317" selection-end="1317" vertical-scroll-proportion="0.0" vertical-offset="950" max-vertical-offset="1064" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/match.js">
<provider selected="true" editor-type-id="text-editor">
<state line="89" column="19" selection-start="2900" selection-end="2900" vertical-scroll-proportion="0.0" vertical-offset="1691" max-vertical-offset="2147" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/deprecated.js">
<provider selected="true" editor-type-id="text-editor">
<state line="16" column="6" selection-start="473" selection-end="473" vertical-scroll-proportion="0.0" vertical-offset="304" max-vertical-offset="722" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/eql.js">
<provider selected="true" editor-type-id="text-editor">
<state line="20" column="42" selection-start="550" selection-end="550" vertical-scroll-proportion="0.0" vertical-offset="215" max-vertical-offset="2052" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/assert.js">
<provider selected="true" editor-type-id="text-editor">
<state line="33" column="12" selection-start="681" selection-end="681" vertical-scroll-proportion="0.0" vertical-offset="627" max-vertical-offset="1178" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/should.js">
<provider selected="true" editor-type-id="text-editor">
<state line="39" column="45" selection-start="909" selection-end="909" vertical-scroll-proportion="0.0" vertical-offset="741" max-vertical-offset="3249" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/type.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="3" selection-start="3" selection-end="3" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1463" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/number.js">
<provider selected="true" editor-type-id="text-editor">
<state line="26" column="5" selection-start="705" selection-end="705" vertical-scroll-proportion="0.0" vertical-offset="494" max-vertical-offset="1045" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/should.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="46" column="0" selection-start="953" selection-end="953" vertical-scroll-proportion="0.0" vertical-offset="874" max-vertical-offset="988" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ext/bool.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="65" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="988" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Makefile">
<provider selected="true" editor-type-id="text-editor">
<state line="3" column="63" selection-start="108" selection-end="108" vertical-scroll-proportion="0.0" vertical-offset="57" max-vertical-offset="266" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/util.js">
<provider selected="true" editor-type-id="text-editor">
<state line="3" column="16" selection-start="73" selection-end="73" vertical-scroll-proportion="0.0" vertical-offset="57" max-vertical-offset="361" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ext/number.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="125" column="3" selection-start="3035" selection-end="3035" vertical-scroll-proportion="0.0" vertical-offset="1615" max-vertical-offset="2508" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/exist.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="0" selection-start="92" selection-end="544" vertical-scroll-proportion="0.0" vertical-offset="95" max-vertical-offset="2052" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/should.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="44745" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/eql.js">
<provider selected="true" editor-type-id="text-editor">
<state line="15" column="2" selection-start="466" selection-end="466" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="418" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/bool.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="16" selection-start="0" selection-end="202" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="266" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/exist.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="0" selection-start="92" selection-end="544" vertical-scroll-proportion="0.0" vertical-offset="95" max-vertical-offset="2052" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/util.js">
<provider selected="true" editor-type-id="text-editor">
<state line="3" column="16" selection-start="73" selection-end="73" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="361" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ext/bool.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="65" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="703" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ext/number.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="125" column="3" selection-start="3035" selection-end="3035" vertical-scroll-proportion="0.0" vertical-offset="1615" max-vertical-offset="2508" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/number.js">
<provider selected="true" editor-type-id="text-editor">
<state line="26" column="5" selection-start="705" selection-end="705" vertical-scroll-proportion="0.0" vertical-offset="160" max-vertical-offset="969" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/type.js">
<provider selected="true" editor-type-id="text-editor">
<state line="70" column="41" selection-start="1859" selection-end="1859" vertical-scroll-proportion="0.0" vertical-offset="669" max-vertical-offset="1558" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/browser.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="97" selection-end="496" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="513" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/node.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="822" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/util.js">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="2" selection-start="321" selection-end="321" vertical-scroll-proportion="0.0" vertical-offset="25" max-vertical-offset="2280">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/string.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="97" selection-end="97" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="380">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/http.js">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="46" selection-start="194" selection-end="194" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="646" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/property.js">
<provider selected="true" editor-type-id="text-editor">
<state line="183" column="33" selection-start="5102" selection-end="5102" vertical-scroll-proportion="0.0" vertical-offset="3236" max-vertical-offset="4104" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/error.js">
<provider selected="true" editor-type-id="text-editor">
<state line="50" column="2" selection-start="1317" selection-end="1317" vertical-scroll-proportion="0.0" vertical-offset="492" max-vertical-offset="988" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/match.js">
<provider selected="true" editor-type-id="text-editor">
<state line="86" column="5" selection-start="2819" selection-end="2819" vertical-scroll-proportion="0.0" vertical-offset="1281" max-vertical-offset="2147" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/deprecated.js">
<provider selected="true" editor-type-id="text-editor">
<state line="16" column="6" selection-start="473" selection-end="473" vertical-scroll-proportion="0.0" vertical-offset="71" max-vertical-offset="646" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/eql.js">
<provider selected="true" editor-type-id="text-editor">
<state line="20" column="42" selection-start="550" selection-end="550" vertical-scroll-proportion="0.0" vertical-offset="215" max-vertical-offset="2052" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/assert.js">
<provider selected="true" editor-type-id="text-editor">
<state line="33" column="12" selection-start="681" selection-end="681" vertical-scroll-proportion="0.0" vertical-offset="280" max-vertical-offset="1102" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/node_modules/mocha/lib/reporters/dot.js">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1273">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/should.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="46" column="0" selection-start="953" selection-end="953" vertical-scroll-proportion="1.4446281" vertical-offset="0" max-vertical-offset="988" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ext/property.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="161" column="0" selection-start="4907" selection-end="4907" vertical-scroll-proportion="0.0" vertical-offset="2702" max-vertical-offset="3762" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/node_modules/mocha/lib/reporters/base.js">
<provider selected="true" editor-type-id="text-editor">
<state line="190" column="71" selection-start="3932" selection-end="3932" vertical-scroll-proportion="0.41530055" vertical-offset="3382" max-vertical-offset="9747" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/should.js">
<provider selected="true" editor-type-id="text-editor">
<state line="138" column="44" selection-start="3022" selection-end="3022" vertical-scroll-proportion="0.0" vertical-offset="2622" max-vertical-offset="3249">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/ext/browser/jquery.test.js">
<provider selected="true" editor-type-id="text-editor">
<state line="202" column="0" selection-start="5749" selection-end="5749" vertical-scroll-proportion="0.0" vertical-offset="6308" max-vertical-offset="7676">
<folding>
<marker date="1390468484000" expanded="false" signature="1894:1915" placeholder="..." />
<marker date="1390468484000" expanded="false" signature="2040:2062" placeholder="..." />
<marker date="1390468484000" expanded="false" signature="2168:2191" placeholder="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ext/browser/jquery.js">
<provider selected="true" editor-type-id="text-editor">
<state line="95" column="16" selection-start="3293" selection-end="3293" vertical-scroll-proportion="0.0" vertical-offset="1463" max-vertical-offset="4446">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Makefile">
<provider selected="true" editor-type-id="text-editor">
<state line="9" column="20" selection-start="275" selection-end="275" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="285">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Readme.md">
<provider selected="true" editor-type-id="text-editor">
<state line="69" column="0" selection-start="1898" selection-end="1898" vertical-scroll-proportion="0.0" vertical-offset="703" max-vertical-offset="12350">
<folding />
</state>
</provider>
<provider editor-type-id="MarkdownPreviewEditor">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state line="2" column="21" selection-start="108" selection-end="108" vertical-scroll-proportion="-1.52" vertical-offset="0" max-vertical-offset="418">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/History.md">
<provider selected="true" editor-type-id="text-editor">
<state line="14" column="0" selection-start="281" selection-end="281" vertical-scroll-proportion="0.4801444" vertical-offset="0" max-vertical-offset="4332">
<folding />
</state>
</provider>
<provider editor-type-id="MarkdownPreviewEditor">
<state />
</provider>
</entry>
</component>
</project>
+2
View File
@@ -0,0 +1,2 @@
examples
test
+222
View File
@@ -0,0 +1,222 @@
3.1.2 / 2014-01-28
==================
* Fix for adding .inspect for JQuery object only in case when it is exist
3.1.1 / 2014-01-28
==================
* Fix for HTMLElement in DOM less environments
3.1.0 / 2014-01-23
==================
* Added jquery based broser extension
3.0.1 / 2014-01-17
==================
* Fix: .lengthOf()
3.0.0 / 2014-01-17
==================
* Split everything to smaller files
* Added huge extension to .match and .matchEach. Thanks @alsotang for initial code and idea.
* Added .containDeep and .containEql
* Separate build for browser and node.js
* Basic plugin system
* Breaking change: .Object now do not fail on arrays
* Breaking change: Additional messages now replaces generated and do not added
* Breaking change: .keys now check as is - no keys in args means no keys in object
* Deprecated: assert extension
* Deprecated: .include and .includeEql
* Now all assertions define only positive cases, should.js take care about negations and chains
2.1.1 / 2013-12-05
==================
* Move date formatting out of should.inspect
2.1.0 / 2013-11-11
==================
* Override .inspect for Date's to convert them to ISOString
2.0.2 / 2013-10-21
==================
* Add '#of' as getter for chaining.
* Exclude browser script for .npmignore.
2.0.1 / 2013-10-10
==================
* Fix wrong path in .npmignore.
2.0.0 / 2013-10-10
==================
* breaking change: #a now getter like #an. Was replaced with #type(str)
* breaking change: #empty does not check length for objects. Now it check if object do not have own properties.
* #properties check if object have some properties
* util.inspect now exposed as should.inspect
* assertions for NaN, Infinity, Array, Object, String, Boolean, Number, Error, Function
* #equal got alias #exactly
1.3.0 / 2013-09-13
==================
* fix doc for .keys. Closes #108.
* add #endWith()
* add .startWith (#119)
1.2.2 / 2013-02-19
==================
* fix should.be.instanceOf() failure on Date
1.2.1 / 2012-11-02
==================
* add .showDiff
* Make instanceOf and throwError be aliased like others [alFReD-NSH]
* Fix should[.not].exist not having stack trace #84 [alFReD-NSH]
1.2.0 / 2012-09-21
==================
* Added #approximately(value, delta, description) for doing assertions on results of operations with numbers. [titarenko]
1.1.1 / 2012-09-19
==================
* add .type for eql()s assert
1.1.0 / 2012-07-30
==================
* add enclosing of failure message functions. Closes #81
* add mocha .actual / .expected string support for all assertion values
0.7.0 / 2012-07-17
==================
* add `.throw(Constructor)` support [snakamura]
0.6.3 / 2012-04-26
==================
* Added object inclusion support back
0.6.2 / 2012-04-26
==================
* Added homepage to package.json
* Fixed .equal() with dates. Closes #63
0.6.1 / 2012-04-10
==================
* package: add "repository" section [TooTallNate]
* use valueOf() to get the reference the object [TooTallNate]
0.6.0 / 2012-03-01
==================
* Added `err.actual` and `err.expected` for .{eql,equal}()
* Added 'return this;' to 'get json' and 'get html' in order to provide chaining for should.be.json and should.be.html
0.5.1 / 2012-01-13
==================
* Added better `.json`
* Added better `.html`
0.5.0 / 2012-01-12
==================
* Added string matching to `.throw()` [serby]
* Added regexp matching to `.throw()` [serby]
* Added `.includeEql()` [RubenVerborgh]
* Added `.should.be.html`
* Added `.should.be.json`
* Added optional description args to most matchers [Mike Swift]
0.4.2 / 2011-12-17
==================
* Fixed .header() for realzzz
0.4.1 / 2011-12-16
==================
* Fixed: chain .header() to retain negation
0.4.0 / 2011-12-16
==================
* Added `.should.throw()`
* Added `.include()` support for strings
* Added `.include()` support for arrays
* Removed `keys()` `.include` modifier support
* Removed `.object()`
* Removed `.string()`
* Removed `.contain()`
* Removed `.respondTo()` rubyism
* expresso -> mocha
0.3.2 / 2011-10-24
==================
* Fixed tests for 0.5.x
* Fixed sys warning
0.3.1 / 2011-08-22
==================
* configurable
0.3.0 / 2011-08-20
==================
* Added assertion for inclusion of an object: `foo.should.include.object({ foo: 'bar' })`
0.2.1 / 2011-05-13
==================
* Fixed .status(code). Closes #18
0.2.0 / 2011-04-17
==================
* Added `res.should.have.status(code)` method
* Added `res.should.have.header(field, val)` method
0.1.0 / 2011-04-06
==================
* Added `should.exist(obj)` [aseemk]
* Added `should.not.exist(obj)` [aseemk]
0.0.4 / 2010-11-24
==================
* Added `.ok` to assert truthfulness
* Added `.arguments`
* Fixed double required bug. [thanks dominictarr]
0.0.3 / 2010-11-19
==================
* Added `true` / `false` assertions
0.0.2 / 2010-11-19
==================
* Added chaining support
0.0.1 / 2010-11-19
==================
* Initial release
+10
View File
@@ -0,0 +1,10 @@
TESTS=$(shell find test -name *.test.js)
test:
@browserify lib/browser.js -s Should --dg false -o should.js.for-tests
@./node_modules/.bin/mocha --ui exports --recursive $(TESTS)
browser:
@browserify lib/browser.js -s Should --dg false -o should.js
.PHONY: test browser
+644
View File
@@ -0,0 +1,644 @@
# should.js
_should_ is an expressive, readable, test framework agnostic, assertion library. Main goals of this library __to be expressive__ and __to be helpful__. It means test code should be clean, and error messages enough helpfull to understand error.
It extends the `Object.prototype` with a single non-enumerable getter that allows you to express how that object should behave, also it returns itself when required with `require`.
## Example
```javascript
var should = require('should');
var user = {
name: 'tj'
, pets: ['tobi', 'loki', 'jane', 'bandit']
};
user.should.have.property('name', 'tj');
user.should.have.property('pets').with.lengthOf(4);
// if the object was created with Object.create(null)
// then it doesn't inherit `Object` and have the `should` getter
// so you can do:
should(user).have.property('name', 'tj');
should(true).ok;
someAsyncTask(foo, function(err, result){
should.not.exist(err);
should.exist(result);
result.bar.should.equal(foo);
});
```
## To begin
1. Install it:
$ npm install should --save-dev
2. Require it and use:
```javascript
var should = require('should');
(5).should.be.exactly(5).and.be.a.Number;
```
## In browser
If you want to use _should_ in browser, use version that is in root of repository (or build it yourself). It is builded with browserify (see [Makefile](https://github.com/visionmedia/should.js/blob/master/Makefile)). To build fresh version:
```bash
# you should have browserify
npm install -g browserify
make browser
```
This script exported to `window.Should`. It is the same as use `should` statically:
```js
Should(5).be.exactly(5)
```
Also as for node.js case `Object.prototype` extended with `should` (that is why `window.Should` used):
```js
window.should.be.exactly(window);
// the same
// window is host object
should.be.exactly(window);
// you should not really care about it
(5).should.be.exactly(5);
```
*should.js* uses EcmaScript 5 very extensively so any browser that support ES5 is supported. (IE <=8 not supported).
See [kangax's compat table](http://kangax.github.io/es5-compat-table) to know which exactly.
You can easy install it with again npm or bower:
```
npm install should --save-dev
# or
bower install visionmedia/should.js
```
## Static should and assert module
For some rare cases should can be used statically, without `Object.prototype`.
It can be replacement for node assert module:
```javascript
assert.fail(actual, expected, message, operator) // just write wrong should assertion
assert(value, message), assert.ok(value, [message]) // should(value).ok
assert.equal(actual, expected, [message]) // should(actual).eql(expected, [message])
assert.notEqual(actual, expected, [message]) // should(actual).not.eql(expected, [message])
assert.deepEqual(actual, expected, [message]) // should(actual).eql(expected, [message])
assert.notDeepEqual(actual, expected, [message]) // should(actual).not.eql(expected, [message])
assert.strictEqual(actual, expected, [message]) // should(actual).equal(expected, [message])
assert.notStrictEqual(actual, expected, [message]) // should(actual).not.equal(expected, [message])
assert.throws(block, [error], [message]) // should(block).throw([error])
assert.doesNotThrow(block, [message]) // should(block).not.throw([error])
assert.ifError(value) // should(value).Error (to check if it is error) or should(value).not.ok (to check that it is falsy)
```
## .not
`.not` negate current assertion.
# Assertions
## chaining assertions
Every assertion will return a `should.js`-wrapped Object, so assertions can be chained.
You can use this helpers to just chain: `.an`, `.of`, `.a`, `.and`, `.be`, `.have`, `.with`, `.is`, `.which`. Use them for better readability, they do nothing at all.
For example:
```js
user.should.be.an.instanceOf(Object).and.have.property('name', 'tj');
user.pets.should.be.instanceof(Array).and.have.lengthOf(4);
```
Almost all assertions return the same object - so you can easy chain them. But some move assertion object to property value. See feather, it will be mention if object chainged.
## .ok
Assert if asseted object is truthy in javascript meaning of truthy ('', null, undefined, 0 , NaN, Infinity - is falsy, so all others are truthy).
Assert truthfulness:
```javascript
true.should.be.ok;
'yay'.should.be.ok;
(1).should.be.ok;
({}).should.be.ok;
```
or negated:
```javascript
false.should.not.be.ok;
''.should.not.be.ok;
(0).should.not.be.ok;
```
## .true
Assert if asseted object === true:
```javascript
true.should.be.true;
'1'.should.not.be.true;
```
## .false
Assert if asseted object === false:
```javascript
false.should.be.false;
(0).should.not.be.false;
```
## .eql(otherValue)
Assert if asserted object is *equal* to otherValue. This means that object compared by its actual content, not just reference equality.
```javascript
({ foo: 'bar' }).should.eql({ foo: 'bar' });
[1,2,3].should.eql([1,2,3]);
// see next example it is correct, even if it is different types, but actual content the same
[1, 2, 3].should.eql({ '0': 1, '1': 2, '2': 3 });
```
## .equal(otherValue) and .exactly(otherValue)
Assert if asserted object strictly equal to `otherValue` (using `===` - no type conversion for primitive types and reference equivalence for reference types).
```javascript
(4).should.equal(4);
'test'.should.equal('test');
[1,2,3].should.not.equal([1,2,3]);
(4).should.be.exactly(4);
```
## .startWith(str)
Assert that string starts with `str`.
```javascript
'foobar'.should.startWith('foo');
'foobar'.should.not.startWith('bar');
```
## .endWith(str)
Assert that string ends with `str`.
```javascript
'foobar'.should.endWith('bar');
'foobar'.should.not.endWith('foo');
```
## .within(from, to)
Assert inclusive numeric range (`<= to` and `>= from`):
```javascript
user.age.should.be.within(5, 50);
(5).should.be.within(5, 10).and.within(5, 5);
```
## .approximately(num, delta)
Assert floating point number near `num` within `delta` margin:
```javascript
(99.99).should.be.approximately(100, 0.1);
```
## .above(num) and .greaterThan(num)
Assert numeric value above the given value (`> num`):
```javascript
user.age.should.be.above(5);
user.age.should.not.be.above(100);
(5).should.be.above(0);
(5).should.not.be.above(5);
```
## .below(num) and .lessThan(num)
Assert numeric value below the given value (`< num`):
```javascript
user.age.should.be.below(100);
user.age.should.not.be.below(5);
(5).should.be.below(6);
(5).should.not.be.below(5);
```
## .NaN
Assert numeric value is NaN:
```javascript
(undefined + 0).should.be.NaN;
```
## .Infinity
Assert numeric value is Infinity:
```javascript
(1/0).should.be.Infinity;
```
## .type(str)
Assert given value have such type (using __typeof__ operator):
```javascript
user.should.be.type('object');
'test'.should.be.type('string');
```
## .instanceof(constructor) and .instanceOf(constructor)
Assert given value is instance of `constructor` (using __instanceof__ operator):
```javascript
user.should.be.an.instanceof(User);
[].should.be.an.instanceOf(Array);
```
## .arguments
Assert given object is an `Arguments`:
```javascript
var args = (function(){ return arguments; })(1,2,3);
args.should.be.arguments;
[].should.not.be.arguments;
```
## .Object, .Number, .Array, .Boolean, .Function, .String, .Error
Assert given object is instance of such constructor (shortcut for `.instanceof` assertion).
```javascript
({}).should.be.an.Object;
(1).should.be.a.Number;
[].should.be.an.Array.and.an.Object;
(true).should.be.a.Boolean;
''.should.be.a.String;
```
## .property(name[, value])
Assert property exists and has optional value(compare using `.eql`):
```javascript
user.should.have.property('name');
user.should.have.property('age', 15);
user.should.not.have.property('rawr');
user.should.not.have.property('age', 0);
[1, 2].should.have.property('0', 1);
```
__NB__ `.property` change object to actual property value!
## .properties(propName1, propName2, ...) or .properties([propName1, propName2, ...]) or .properties(obj)
`obj` it is object that map properties to their actual values.
Assert all given properties exists and have given values (compare using `.eql`):
```javascript
user.should.have.properties('name', 'age');
user.should.have.properties(['name', 'age']);
user.should.have.properties({
name: 'denis',
age: 24
});
```
## .length(number) and .lengthOf(number)
Assert _length_ property exists and has a value of the given number (shortcut for `.property('length', number)`):
```javascript
user.pets.should.have.length(5);
user.pets.should.have.a.lengthOf(5);
({ length: 10}).should.have.length(10);
```
__NB__ `.length` change object to actual property value!
## .ownProperty(str) and .hasOwnProperty(str)
Assert given object has own property (using `.hasOwnProperty`):
```javascript
({ foo: 'bar' }).should.have.ownProperty('foo').equal('bar');
```
__NB__ `.length` change object to actual property value!
## .empty
Assert given value is empty. It means for strings, arrays, arguments length == 0 and for object do not have own properties.
```javascript
[].should.be.empty;
''.should.be.empty;
({}).should.be.empty;
(function() {
arguments.should.be.empty;
})();
```
## .keys([key1, key2, ...]) and .keys(key1, key2, ...) and .key(key)
Assert own object keys, which must match _exactly_,
and will fail if you omit a key or two:
```javascript
var obj = { foo: 'bar', baz: 'raz' };
obj.should.have.keys('foo', 'baz');
obj.should.have.keys(['foo', 'baz']);
({}).should.have.keys();
({}).should.have.keys('key'); //fail AssertionError: expected {} to have key 'key'missing keys: 'key'
```
## .containEql(otherValue)
Assert given value to contain something *.eql* to otherValue. See examples to understand better:
```javascript
'hello boy'.should.containEql('boy');
[1,2,3].should.containEql(3);
[[1],[2],[3]].should.containEql([3]);
[[1],[2],[3, 4]].should.not.containEql([3]);
({ b: 10 }).should.containEql({ b: 10 });
([1, 2, { a: 10 }]).should.containEql({ a: 10 });
[1, 2, 3].should.not.containEql({ a: 1 });
[{a: 'a'}, {b: 'b', c: 'c'}].should.containEql({a: 'a'});
[{a: 'a'}, {b: 'b', c: 'c'}].should.not.containEql({b: 'b'});
```
## .containDeep(otherValue)
Assert given value to contain something *.eql* to otherValue within depth.
Again see examples:
```javascript
'hello boy'.should.containDeep('boy');
[1,2,3].should.containDeep([3]);
[1,2,3].should.containDeep([1, 3]);
//but not
[1,2,3].should.containDeep([3, 1]);
({ a: { b: 10 }, b: { c: 10, d: 11, a: { b: 10, c: 11} }}).should
.containDeep({ a: { b: 10 }, b: { c: 10, a: { c: 11 }}});
[1, 2, 3, { a: { b: { d: 12 }}}].should.containDeep([{ a: { b: {d: 12}}}]);
[[1],[2],[3]].should.containDeep([[3]]);
[[1],[2],[3, 4]].should.containDeep([[3]]);
[{a: 'a'}, {b: 'b', c: 'c'}].should.containDeep([{a: 'a'}]);
[{a: 'a'}, {b: 'b', c: 'c'}].should.containDeep([{b: 'b'}]);
```
It does not search somewhere in depth it check all pattern in depth. Object checked
by properties key and value, arrays checked like sub sequences. Everyting compared using .eql.
Main difference with `.containEql` is that this assertion require full type chain -
if asserted value is an object, otherValue should be also an object (which is sub object of given).
The same true for arrays, otherValue should be an array which compared to be subsequence of given object.
## .match(otherValue)
Assert given object to match `otherValue`.
Given: String, otherValue: regexp. Uses `RegExp#exec(str)`:
```javascript
username.should.match(/^\w+$/)
```
Given: Array, otherValue: regexp - assert each value match to regexp.
```javascript
['a', 'b', 'c'].should.match(/[a-z]/);
['a', 'b', 'c'].should.not.match(/[d-z]/);
```
Given: Object, otherValue: regexp - assert own property's values to match regexp.
```javascript
({ a: 'foo', c: 'barfoo' }).should.match(/foo$/);
({ a: 'a' }).should.not.match(/^http/);
```
Given: Anything, otherValue: function - assert if given value matched to function.
Function can use .should inside or return 'true' or 'false', in all other cases it do nothing. If you return value that return assertion, you will receive better error messages.
```javascript
(5).should.match(function(n) { return n > 0; });
(5).should.not.match(function(n) { return n < 0; });
(5).should.not.match(function(it) { it.should.be.an.Array; });
(5).should.match(function(it) { return it.should.be.a.Number; });
```
Now compare messages:
```javascript
(5).should.not.match(function(it) { it.should.be.a.Number; });
//AssertionError: expected 5 not to match [Function]
(5).should.not.match(function(it) { return it.should.be.a.Number; });
//AssertionError: expected 5 not to match [Function]
// expected 5 to be a number
```
Given: object, otherValue: another object - assert that object properties match to properties of another object in meaning that describe above cases. See examples:
```javascript
({ a: 10, b: 'abc', c: { d: 10 }, d: 0 }).should
.match({ a: 10, b: /c$/, c: function(it) { return it.should.have.property('d', 10); }});
[10, 'abc', { d: 10 }, 0].should
.match({ '0': 10, '1': /c$/, '2': function(it) { return it.should.have.property('d', 10); } });
[10, 'abc', { d: 10 }, 0].should
.match([10, /c$/, function(it) { return it.should.have.property('d', 10); }]);
```
## .matchEach(otherValue)
Assert given property keys and values each match given check object.
If `otherValue` is RegExp, then each property value checked to match it:
```javascript
(['a', 'b', 'c']).should.matchEach(/[a-c]/);
```
If `otherValue` is Function, then check each property value and key matched it:
```javascript
[10, 11, 12].should.matchEach(function(it) { return it >= 10; });
[10, 11, 12].should.matchEach(function(it) { return it >= 10; });
```
In other cases it check that each property value is `.eql` to `otherValue`:
```javascript
[10, 10].should.matchEach(10);
```
## .throw() and throwError()
Assert an exception is thrown:
```js
(function(){
throw new Error('fail');
}).should.throw();
```
Assert an exception is not thrown:
```js
(function(){
}).should.not.throw();
```
Assert exception message matches string:
```js
(function(){
throw new Error('fail');
}).should.throw('fail');
```
Assert exepection message matches regexp:
```js
(function(){
throw new Error('failed to foo');
}).should.throw(/^fail/);
```
If you need to pass arguments and/or context to execute function use `Function#bind(context, arg1, ...)`:
```js
function isPositive(n) {
if(n <= 0) throw new Error('Given number is not positive')
}
isPositive.bind(null, 10).should.not.throw();
isPositive.bind(null, -10).should.throw();
```
If you need to check something in asynchronous function it is required to do in 2 steps:
```js
// first we need to check that function is called
var called = false;
collection.findOne({ _id: 10 }, function(err, res) {
called = true;
//second we test what you want
res.should.be....
});
called.should.be.true;
```
In case you are using something like `Mocha`, you should use asynchronous test and call `done()` in proper place to make sure that you asynchronous function is called before test is finished.
```js
collection.findOne({ _id: 10 }, function(err, res) {
if(err) return done(err);
//second we test what you want
res.should.be....
done();
});
```
In general case if you need to check that something is executed you need such thing as `spies`, good example is an [sinon](http://sinonjs.org/).
## .status(code)
Asserts that `.statusCode` is `code`:
```javascript
res.should.have.status(200);
```
Not included in browser build.
## .header(field[, value])
Asserts that a `.headers` object with `field` and optional `value` are present:
```javascript
res.should.have.header('content-length');
res.should.have.header('Content-Length', '123');
```
Not included in browser build.
## .json
Assert that Content-Type is "application/json; charset=utf-8"
```javascript
res.should.be.json
```
Not included in browser build.
## .html
Assert that Content-Type is "text/html; charset=utf-8"
```javascript
res.should.be.html
```
Not included in browser build.
## Optional Error description
As it can often be difficult to ascertain exactly where failed assertions are coming from in your tests, an optional description parameter can be passed to several should matchers. The description will follow the failed assertion in the error:
(1).should.eql(0, 'some useful description')
AssertionError: some useful description
at Object.eql (/Users/swift/code/should.js/node_modules/should/lib/should.js:280:10)
...
The methods that support this optional description are: `eql`, `equal`, `within`, `instanceof`, `above`, `below`, `match`, `length`, `property`, `ownProperty`.
## Mocha example
For example you can use should with the [Mocha test framework](http://visionmedia.github.io/mocha/) by simply including it:
```javascript
var should = require('should');
var mylib = require('mylib');
describe('mylib', function () {
it('should have a version with the format #.#.#', function() {
lib.version.should.match(/^\d+\.\d+\.\d+$/);
}
});
```
## Contributions
[Actual list of contributors](https://github.com/visionmedia/should.js/graphs/contributors) if you want to show it your friends.
To run the tests for _should_ simply run:
$ make test
Before contribute something:
1. Your code looks like all other code - all project should look like it was written by one man, always.
2. If you want propose something - just create issue and describe your question with much description as you can.
3. Please never send issues or pull requests about code style, jshint violations etc - i do not accept it (and you will spend your time for free).
4. If you think you have some general receipt, consider create PR with it.
5. If you not sure if you receipt enough general just create your own plugin for should.js. (see should.use and Assertion.add usage).
6. If you add new code it should be covered by tests, no tests - no code.
7. If you find bug (or at least you think it is a bug), create issue with library version and test case that I can run and see what are you talking about, or at least full steps that I can reproduce it.
## OMG IT EXTENDS OBJECT???!?!@
Yes, yes it does, with a single getter _should_, and no it won't break your code, because it does this **properly** with a non-enumerable property.
## License
MIT
+2
View File
@@ -0,0 +1,2 @@
module.exports = require('./lib/node.js');
+23
View File
@@ -0,0 +1,23 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var should = require('./should');
should
.use(require('./ext/assert'))
.use(require('./ext/chain'))
.use(require('./ext/bool'))
.use(require('./ext/number'))
.use(require('./ext/eql'))
.use(require('./ext/type'))
.use(require('./ext/string'))
.use(require('./ext/property'))
.use(require('./ext/error'))
.use(require('./ext/match'))
.use(require('./ext/browser/jquery'))
.use(require('./ext/deprecated'));
module.exports = should;
+102
View File
@@ -0,0 +1,102 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
// Taken from node's assert module, because it sucks
// and exposes next to nothing useful.
var util = require('./util');
module.exports = _deepEqual;
var pSlice = Array.prototype.slice;
function _deepEqual(actual, expected) {
// 7.1. All identical values are equivalent, as determined by ===.
if (actual === expected) {
return true;
} else if (util.isBuffer(actual) && util.isBuffer(expected)) {
if (actual.length != expected.length) return false;
for (var i = 0; i < actual.length; i++) {
if (actual[i] !== expected[i]) return false;
}
return true;
// 7.2. If the expected value is a Date object, the actual value is
// equivalent if it is also a Date object that refers to the same time.
} else if (util.isDate(actual) && util.isDate(expected)) {
return actual.getTime() === expected.getTime();
// 7.3 If the expected value is a RegExp object, the actual value is
// equivalent if it is also a RegExp object with the same source and
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
} else if (util.isRegExp(actual) && util.isRegExp(expected)) {
return actual.source === expected.source &&
actual.global === expected.global &&
actual.multiline === expected.multiline &&
actual.lastIndex === expected.lastIndex &&
actual.ignoreCase === expected.ignoreCase;
// 7.4. Other pairs that do not both pass typeof value == 'object',
// equivalence is determined by ==.
} else if (!util.isObject(actual) && !util.isObject(expected)) {
return actual == expected;
// 7.5 For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
// with Object.prototype.hasOwnProperty.call), the same set of keys
// (although not necessarily the same order), equivalent values for every
// corresponding key, and an identical 'prototype' property. Note: this
// accounts for both named and indexed properties on Arrays.
} else {
return objEquiv(actual, expected);
}
}
function objEquiv (a, b) {
if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
return false;
// an identical 'prototype' property.
if (a.prototype !== b.prototype) return false;
//~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem.
if (util.isArguments(a)) {
if (!util.isArguments(b)) {
return false;
}
a = pSlice.call(a);
b = pSlice.call(b);
return _deepEqual(a, b);
}
try{
var ka = Object.keys(a),
kb = Object.keys(b),
key, i;
} catch (e) {//happens when one is a string literal and the other isn't
return false;
}
// having the same number of owned properties (keys incorporates
// hasOwnProperty)
if (ka.length != kb.length)
return false;
//the same set of keys (although not necessarily the same order),
ka.sort();
kb.sort();
//~~~cheap key test
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] != kb[i])
return false;
}
//equivalent values for every corresponding key, and
//~~~possibly expensive deep test
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!_deepEqual(a[key], b[key])) return false;
}
return true;
}
+57
View File
@@ -0,0 +1,57 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var util = require('../util')
, assert = require('assert')
, AssertionError = assert.AssertionError;
module.exports = function(should) {
var i = should.format;
/**
* Expose assert to should
*
* This allows you to do things like below
* without require()ing the assert module.
*
* should.equal(foo.bar, undefined);
*
*/
util.merge(should, assert);
/**
* Assert _obj_ exists, with optional message.
*
* @param {*} obj
* @param {String} [msg]
* @api public
*/
should.exist = should.exists = function(obj, msg) {
if(null == obj) {
throw new AssertionError({
message: msg || ('expected ' + i(obj) + ' to exist'), stackStartFunction: should.exist
});
}
};
/**
* Asserts _obj_ does not exist, with optional message.
*
* @param {*} obj
* @param {String} [msg]
* @api public
*/
should.not = {};
should.not.exist = should.not.exists = function(obj, msg) {
if(null != obj) {
throw new AssertionError({
message: msg || ('expected ' + i(obj) + ' to not exist'), stackStartFunction: should.not.exist
});
}
};
};
+21
View File
@@ -0,0 +1,21 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
module.exports = function(should, Assertion) {
Assertion.add('true', function() {
this.is.exactly(true)
}, true);
Assertion.add('false', function() {
this.is.exactly(false)
}, true);
Assertion.add('ok', function() {
this.params = { operator: 'to be truthy' };
this.assert(this.obj);
}, true);
};
+229
View File
@@ -0,0 +1,229 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/*!
* Portions copyright (c) 2010, 2011, 2012 Wojciech Zawistowski, Travis Jeffery
* From the jasmine-jquery project under the MIT License.
*/
var util = require('../../util');
module.exports = function(should, Assertion) {
var i = should.format;
var $ = this.jQuery || this.$;
/* Otherwise, node's util.inspect loops hangs */
if (typeof HTMLElement !== "undefined" && HTMLElement && !HTMLElement.prototype.inspect) {
HTMLElement.prototype.inspect = function () {
return this.outerHTML;
};
}
if (typeof jQuery !== "undefined" && jQuery && !jQuery.prototype.inspect) {
jQuery.fn.inspect = function () {
var elementList = this.toArray().map(function (e) {
return util.inspect(e);
}).join(", ");
if (this.selector) {
return "SELECTOR(" + this.selector + ") matching " + this.length + " elements" + (elementList.length ? ": " + elementList : "");
} else {
return elementList;
}
};
}
function jQueryAttributeTestHelper(method, singular, plural, nameOrHash, value) {
var keys = util.isObject(nameOrHash) ? Object.keys(nameOrHash) : [nameOrHash];
var allRelevantAttributes = keys.reduce(function (memo, key) {
var value = $(this.obj)[method](key);
if (typeof value !== 'undefined') {
memo[key] = value;
}
return memo;
}.bind(this), {});
if (arguments.length === 4 && util.isObject(nameOrHash)) {
this.params = { operator: 'to have ' + plural + ' ' + i(nameOrHash) };
allRelevantAttributes.should.have.properties(nameOrHash);
} else if (arguments.length === 4) {
this.params = { operator: 'to have ' + singular + ' ' + i(nameOrHash) };
allRelevantAttributes.should.have.property(nameOrHash);
} else {
this.params = { operator: 'to have ' + singular + ' ' + i(nameOrHash) + ' with value ' + i(value) };
allRelevantAttributes.should.have.property(nameOrHash, value);
}
}
var browserTagCaseIndependentHtml = function (html) {
return $('<div/>').append(html).html();
};
var addJqPredicateAssertion = function (predicate, nameOverride, operatorOverride) {
Assertion.add(nameOverride || predicate, function() {
this.params = { operator: 'to be ' + (operatorOverride || predicate) };
this.assert($(this.obj).is(':' + predicate));
}, true);
}
Assertion.add('className', function(className) {
this.params = { operator: 'to have class ' + className };
this.assert($(this.obj).hasClass(className));
});
Assertion.add('css', function(css) {
this.params = { operator: 'to have css ' + i(css) };
for (var prop in css) {
var value = css[prop];
if (value === 'auto' && $(this.obj).get(0).style[prop] === 'auto') {
continue;
}
$(this.obj).css(prop).should.eql(value);
}
});
addJqPredicateAssertion('visible');
addJqPredicateAssertion('hidden');
addJqPredicateAssertion('selected');
addJqPredicateAssertion('checked');
addJqPredicateAssertion('disabled');
addJqPredicateAssertion('empty', 'emptyJq');
addJqPredicateAssertion('focus', 'focused', 'focused');
Assertion.add('inDOM', function() {
this.params = { operator: 'to be in the DOM' };
this.assert($.contains(document.documentElement, $(this.obj)[0]));
}, true);
Assertion.add('exist', function() {
this.params = { operator: 'to exist' };
$(this.obj).should.not.have.length(0);
}, true);
Assertion.add('attr', function() {
var args = [
'attr',
'attribute',
'attributes'
].concat(Array.prototype.slice.call(arguments, 0));
jQueryAttributeTestHelper.apply(this, args);
});
Assertion.add('prop', function() {
var args = [
'prop',
'property',
'properties'
].concat(Array.prototype.slice.call(arguments, 0));
jQueryAttributeTestHelper.apply(this, args);
});
Assertion.add('elementId', function(id) {
this.params = { operator: 'to have ID ' + i(id) };
this.obj.should.have.attr('id', id);
});
Assertion.add('html', function(html) {
this.params = { operator: 'to have HTML ' + i(html) };
$(this.obj).html().should.eql(browserTagCaseIndependentHtml(html));
});
Assertion.add('containHtml', function(html) {
this.params = { operator: 'to contain HTML ' + i(html) };
$(this.obj).html().indexOf(browserTagCaseIndependentHtml(html)).should.be.above(-1);
});
Assertion.add('text', function(text) {
this.params = { operator: 'to have text ' + i(text) };
var trimmedText = $.trim($(this.obj).text());
if (util.isRegExp(text)) {
trimmedText.should.match(text);
} else {
trimmedText.should.eql(text);
}
});
Assertion.add('containText', function(text) {
this.params = { operator: 'to contain text ' + i(text) };
var trimmedText = $.trim($(this.obj).text());
if (util.isRegExp(text)) {
trimmedText.should.match(text);
} else {
trimmedText.indexOf(text).should.be.above(-1);
}
});
Assertion.add('value', function(val) {
this.params = { operator: 'to have value ' + i(val) };
$(this.obj).val().should.eql(val);
});
Assertion.add('data', function() {
var args = [
'data',
'data',
'data'
].concat(Array.prototype.slice.call(arguments, 0));
jQueryAttributeTestHelper.apply(this, args);
});
Assertion.add('containElement', function(target) {
this.params = { operator: 'to contain ' + $(target).inspect() };
$(this.obj).find(target).should.not.have.length(0);
});
Assertion.add('matchedBy', function(selector) {
this.params = { operator: 'to be matched by selector ' + selector };
$(this.obj).filter(selector).should.not.have.length(0);
});
Assertion.add('handle', function(event) {
this.params = { operator: 'to handle ' + event };
var events = $._data($(this.obj).get(0), "events");
if (!events || !event || typeof event !== "string") {
return this.assert(false);
}
var namespaces = event.split("."),
eventType = namespaces.shift(),
sortedNamespaces = namespaces.slice(0).sort(),
namespaceRegExp = new RegExp("(^|\\.)" + sortedNamespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
if (events[eventType] && namespaces.length) {
for (var i = 0; i < events[eventType].length; i++) {
var namespace = events[eventType][i].namespace;
if (namespaceRegExp.test(namespace)) {
return;
}
}
} else {
events.should.have.property(eventType);
events[eventType].should.not.have.length(0);
return;
}
this.assert(false);
});
Assertion.add('handleWith', function(eventName, eventHandler) {
this.params = { operator: 'to handle ' + eventName + ' with ' + eventHandler };
var normalizedEventName = eventName.split('.')[0],
stack = $._data($(this.obj).get(0), "events")[normalizedEventName];
for (var i = 0; i < stack.length; i++) {
if (stack[i].handler == eventHandler) {
return;
}
}
this.assert(false);
});
};
+18
View File
@@ -0,0 +1,18 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
module.exports = function(should, Assertion) {
function addLink(name) {
Object.defineProperty(Assertion.prototype, name, {
get: function() {
return this;
}
});
}
['an', 'of', 'a', 'and', 'be', 'have', 'with', 'is', 'which'].forEach(addLink);
};
+33
View File
@@ -0,0 +1,33 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var util = require('../util'),
eql = require('../eql');
module.exports = function(should, Assertion) {
var i = should.format;
Assertion.add('include', function(obj, description) {
if(!Array.isArray(this.obj) && !util.isString(this.obj)) {
this.params = { operator: 'to include an object equal to ' + i(obj), message: description };
var cmp = {};
for(var key in obj) cmp[key] = this.obj[key];
this.assert(eql(cmp, obj));
} else {
this.params = { operator: 'to include ' + i(obj), message: description };
this.assert(~this.obj.indexOf(obj));
}
});
Assertion.add('includeEql', function(obj, description) {
this.params = { operator: 'to include an object equal to ' + i(obj), message: description };
this.assert(this.obj.some(function(item) {
return eql(obj, item);
}));
});
};
+23
View File
@@ -0,0 +1,23 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var eql = require('../eql');
module.exports = function(should, Assertion) {
Assertion.add('eql', function(val, description) {
this.params = { operator: 'to equal', expected: val, showDiff: true, message: description };
this.assert(eql(val, this.obj));
});
Assertion.add('equal', function(val, description) {
this.params = { operator: 'to be', expected: val, showDiff: true, message: description };
this.assert(val === this.obj);
});
Assertion.alias('equal', 'exactly');
};
+51
View File
@@ -0,0 +1,51 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
module.exports = function(should, Assertion) {
var i = should.format;
Assertion.add('throw', function(message) {
var fn = this.obj
, err = {}
, errorInfo = ''
, ok = true;
try {
fn();
ok = false;
} catch(e) {
err = e;
}
if(ok) {
if('string' == typeof message) {
ok = message == err.message;
} else if(message instanceof RegExp) {
ok = message.test(err.message);
} else if('function' == typeof message) {
ok = err instanceof message;
}
if(message && !ok) {
if('string' == typeof message) {
errorInfo = " with a message matching '" + message + "', but got '" + err.message + "'";
} else if(message instanceof RegExp) {
errorInfo = " with a message matching " + message + ", but got '" + err.message + "'";
} else if('function' == typeof message) {
errorInfo = " of type " + message.name + ", but got " + err.constructor.name;
}
} else {
errorInfo = " (got " + i(err) + ")";
}
}
this.params = { operator: 'to throw exception' + errorInfo };
this.assert(ok);
});
Assertion.alias('throw', 'throwError');
};
+33
View File
@@ -0,0 +1,33 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
//var statusCodes = require('http').STATUS_CODES;
module.exports = function(should, Assertion) {
Assertion.add('header', function(field, val) {
this
.have.property('headers')
.and.have.property(field.toLowerCase(), val);
});
Assertion.add('status', function(code) {
//this.params = { operator: 'to have response code ' + code + ' ' + i(statusCodes[code])
// + ', but got ' + this.obj.statusCode + ' ' + i(statusCodes[this.obj.statusCode]) }
this.have.property('statusCode', code);
});
Assertion.add('json', function() {
this.have.property('headers')
.and.have.property('content-type').include('application/json');
}, true);
Assertion.add('html', function() {
this.have.property('headers')
.and.have.property('content-type').include('text/html');
}, true);
};
+112
View File
@@ -0,0 +1,112 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var util = require('../util'),
eql = require('../eql');
module.exports = function(should, Assertion) {
var i = should.format;
Assertion.add('match', function(other, description) {
this.params = { operator: 'to match ' + i(other), message: description };
if(!eql(this.obj, other)) {
if(util.isRegExp(other)) { // something - regex
if(util.isString(this.obj)) {
this.assert(other.exec(this.obj));
} else if(Array.isArray(this.obj)) {
this.obj.forEach(function(item) {
this.assert(other.exec(item));// should we try to convert to String and exec?
}, this);
} else if(util.isObject(this.obj)) {
var notMatchedProps = [], matchedProps = [];
util.forOwn(this.obj, function(value, name) {
if(other.exec(value)) matchedProps.push(i(name));
else notMatchedProps.push(i(name));
}, this);
if(notMatchedProps.length)
this.params.operator += '\n\tnot matched properties: ' + notMatchedProps.join(', ');
if(matchedProps.length)
this.params.operator += '\n\tmatched properties: ' + matchedProps.join(', ');
this.assert(notMatchedProps.length == 0);
} // should we try to convert to String and exec?
} else if(util.isFunction(other)) {
var res;
try {
res = other(this.obj);
} catch(e) {
if(e instanceof should.AssertionError) {
this.params.operator += '\n\t' + e.message;
}
throw e;
}
if(res instanceof Assertion) {
this.params.operator += '\n\t' + res.getMessage();
}
//if we throw exception ok - it is used .should inside
if(util.isBoolean(res)) {
this.assert(res); // if it is just boolean function assert on it
}
} else if(util.isObject(other)) { // try to match properties (for Object and Array)
notMatchedProps = []; matchedProps = [];
util.forOwn(other, function(value, key) {
try {
this.obj[key].should.match(value);
matchedProps.push(key);
} catch(e) {
if(e instanceof should.AssertionError) {
notMatchedProps.push(key);
} else {
throw e;
}
}
}, this);
if(notMatchedProps.length)
this.params.operator += '\n\tnot matched properties: ' + notMatchedProps.join(', ');
if(matchedProps.length)
this.params.operator += '\n\tmatched properties: ' + matchedProps.join(', ');
this.assert(notMatchedProps.length == 0);
} else {
this.assert(false);
}
}
});
Assertion.add('matchEach', function(other, description) {
this.params = { operator: 'to match each ' + i(other), message: description };
var f = other;
if(util.isRegExp(other))
f = function(it) {
return !!other.exec(it);
};
else if(!util.isFunction(other))
f = function(it) {
return eql(it, other);
};
util.forOwn(this.obj, function(value, key) {
var res = f(value, key);
//if we throw exception ok - it is used .should inside
if(util.isBoolean(res)) {
this.assert(res); // if it is just boolean function assert on it
}
}, this);
});
};
+50
View File
@@ -0,0 +1,50 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
module.exports = function(should, Assertion) {
Assertion.add('NaN', function() {
this.params = { operator: 'to be NaN' };
this.is.a.Number
.and.assert(isNaN(this.obj));
}, true);
Assertion.add('Infinity', function() {
this.params = { operator: 'to be Infinity' };
this.is.a.Number
.and.not.a.NaN
.and.assert(!isFinite(this.obj));
}, true);
Assertion.add('within', function(start, finish, description) {
this.params = { operator: 'to be within ' + start + '..' + finish, message: description };
this.assert(this.obj >= start && this.obj <= finish);
});
Assertion.add('approximately', function(value, delta, description) {
this.params = { operator: 'to be approximately ' + value + " ±" + delta, message: description };
this.assert(Math.abs(this.obj - value) <= delta);
});
Assertion.add('above', function(n, description) {
this.params = { operator: 'to be above ' + n, message: description };
this.assert(this.obj > n);
});
Assertion.add('below', function(n, description) {
this.params = { operator: 'to be below ' + n, message: description };
this.assert(this.obj < n);
});
Assertion.alias('above', 'greaterThan');
Assertion.alias('below', 'lessThan');
};
+215
View File
@@ -0,0 +1,215 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var util = require('../util'),
eql = require('../eql');
var aSlice = Array.prototype.slice;
module.exports = function(should, Assertion) {
var i = should.format;
Assertion.add('property', function(name, val) {
if(arguments.length > 1) {
var p = {};
p[name] = val;
this.have.properties(p);
} else {
this.have.properties(name);
}
this.obj = this.obj[name];
});
Assertion.add('properties', function(names) {
var values = {};
if(arguments.length > 1) {
names = aSlice.call(arguments);
} else if(!Array.isArray(names)) {
if(util.isString(names)) {
names = [names];
} else {
values = names;
names = Object.keys(names);
}
}
var obj = Object(this.obj), missingProperties = [];
//just enumerate properties and check if they all present
names.forEach(function(name) {
if(!(name in obj)) missingProperties.push(i(name));
});
var props = missingProperties;
if(props.length === 0) {
props = names.map(i);
}
var operator = (props.length === 1 ?
'to have property ' : 'to have properties ') + props.join(', ');
this.params = { operator: operator };
this.assert(missingProperties.length === 0);
// check if values in object matched expected
var valueCheckNames = Object.keys(values);
if(valueCheckNames.length) {
var wrongValues = [];
props = [];
// now check values, as there we have all properties
valueCheckNames.forEach(function(name) {
var value = values[name];
if(!eql(obj[name], value)) {
wrongValues.push(i(name) + ' of ' + i(value) + ' (got ' + i(obj[name]) + ')');
} else {
props.push(i(name) + ' of ' + i(value));
}
});
if(wrongValues.length > 0) {
props = wrongValues;
}
operator = (props.length === 1 ?
'to have property ' : 'to have properties ') + props.join(', ');
this.params = { operator: operator };
this.assert(wrongValues.length === 0);
}
});
Assertion.add('length', function(n, description) {
this.have.property('length', n, description);
});
Assertion.alias('length', 'lengthOf');
var hasOwnProperty = Object.prototype.hasOwnProperty;
Assertion.add('ownProperty', function(name, description) {
this.params = { operator: 'to have own property ' + i(name), message: description };
this.assert(hasOwnProperty.call(this.obj, name));
this.obj = this.obj[name];
});
Assertion.alias('hasOwnProperty', 'ownProperty');
Assertion.add('empty', function() {
this.params = { operator: 'to be empty' };
if(util.isString(this.obj) || Array.isArray(this.obj) || util.isArguments(this.obj)) {
this.have.property('length', 0);
} else {
var obj = Object(this.obj); // wrap to reference for booleans and numbers
for(var prop in obj) {
this.have.not.ownProperty(prop);
}
}
}, true);
Assertion.add('keys', function(keys) {
if(arguments.length > 1) keys = aSlice.call(arguments);
else if(arguments.length === 1 && util.isString(keys)) keys = [ keys ];
else if(arguments.length === 0) keys = [];
var obj = Object(this.obj);
// first check if some keys are missing
var missingKeys = [];
keys.forEach(function(key) {
if(!hasOwnProperty.call(this.obj, key))
missingKeys.push(i(key));
}, this);
// second check for extra keys
var extraKeys = [];
Object.keys(obj).forEach(function(key) {
if(keys.indexOf(key) < 0) {
extraKeys.push(i(key));
}
});
var verb = keys.length === 0 ? 'to be empty' :
'to have ' + (keys.length === 1 ? 'key ' : 'keys ');
this.params = { operator: verb + keys.map(i).join(', ')};
if(missingKeys.length > 0)
this.params.operator += '\n\tmissing keys: ' + missingKeys.join(', ');
if(extraKeys.length > 0)
this.params.operator += '\n\textra keys: ' + extraKeys.join(', ');
this.assert(missingKeys.length === 0 && extraKeys.length === 0);
});
Assertion.alias("keys", "key");
Assertion.add('containEql', function(other) {
this.params = { operator: 'to contain ' + i(other) };
var obj = this.obj;
if(Array.isArray(obj)) {
this.assert(obj.some(function(item) {
return eql(item, other);
}));
} else if(util.isString(obj)) {
// expect obj to be string
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isObject(obj)) {
// object contains object case
util.forOwn(other, function(value, key) {
obj[key].should.eql(value);
});
} else {
//other uncovered cases
this.assert(false);
}
});
Assertion.add('containDeep', function(other) {
this.params = { operator: 'to contain ' + i(other) };
var obj = this.obj;
if(Array.isArray(obj)) {
if(Array.isArray(other)) {
var otherIdx = 0;
obj.forEach(function(item) {
try {
should(item).not.be.null.and.containDeep(other[otherIdx]);
otherIdx++;
} catch(e) {
if(e instanceof should.AssertionError) {
return;
}
throw e;
}
});
this.assert(otherIdx == other.length);
//search array contain other as sub sequence
} else {
this.assert(false);
}
} else if(util.isString(obj)) {// expect other to be string
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isObject(obj)) {// object contains object case
if(util.isObject(other)) {
util.forOwn(other, function(value, key) {
should(obj[key]).not.be.null.and.containDeep(value);
});
} else {//one of the properties contain value
this.assert(false);
}
} else {
this.eql(other);
}
});
};
+19
View File
@@ -0,0 +1,19 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
module.exports = function(should, Assertion) {
Assertion.add('startWith', function(str, description) {
this.params = { operator: 'to start with ' + should.format(str), message: description };
this.assert(0 === this.obj.indexOf(str));
});
Assertion.add('endWith', function(str, description) {
this.params = { operator: 'to end with ' + should.format(str), message: description };
this.assert(this.obj.indexOf(str, this.obj.length - str.length) >= 0);
});
};
+77
View File
@@ -0,0 +1,77 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var util = require('../util');
module.exports = function(should, Assertion) {
Assertion.add('Number', function() {
this.params = { operator: 'to be a number' };
this.assert(util.isNumber(this.obj));
}, true);
Assertion.add('arguments', function() {
this.params = { operator: 'to be arguments' };
this.assert(util.isArguments(this.obj));
}, true);
Assertion.add('type', function(type, description) {
this.params = { operator: 'to have type ' + type, message: description };
(typeof this.obj).should.be.exactly(type, description);
});
Assertion.add('instanceof', function(constructor, description) {
this.params = { operator: 'to be an instance of ' + constructor.name, message: description };
this.assert(Object(this.obj) instanceof constructor);
});
Assertion.add('Function', function() {
this.params = { operator: 'to be a function' };
this.assert(util.isFunction(this.obj));
}, true);
Assertion.add('Object', function() {
this.params = { operator: 'to be an object' };
this.assert(util.isObject(this.obj));
}, true);
Assertion.add('String', function() {
this.params = { operator: 'to be a string' };
this.assert(util.isString(this.obj));
}, true);
Assertion.add('Array', function() {
this.params = { operator: 'to be an array' };
this.assert(Array.isArray(this.obj));
}, true);
Assertion.add('Boolean', function() {
this.params = { operator: 'to be a boolean' };
this.assert(util.isBoolean(this.obj));
}, true);
Assertion.add('Error', function() {
this.params = { operator: 'to be an error' };
this.assert(util.isError(this.obj));
}, true);
Assertion.add('null', function() {
this.params = { operator: 'to be null' };
this.assert(this.obj === null);
}, true);
Assertion.alias('instanceof', 'instanceOf');
};
+23
View File
@@ -0,0 +1,23 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var should = require('./should');
should
.use(require('./ext/assert'))
.use(require('./ext/chain'))
.use(require('./ext/bool'))
.use(require('./ext/number'))
.use(require('./ext/eql'))
.use(require('./ext/type'))
.use(require('./ext/string'))
.use(require('./ext/property'))
.use(require('./ext/http'))
.use(require('./ext/error'))
.use(require('./ext/match'))
.use(require('./ext/deprecated'));
module.exports = should;
+169
View File
@@ -0,0 +1,169 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var util = require('./util')
, AssertionError = util.AssertionError
, inspect = util.inspect;
/**
* Our function should
* @param obj
* @returns {Assertion}
*/
var should = function(obj) {
return new Assertion(util.isWrapperType(obj) ? obj.valueOf(): obj);
};
/**
* Initialize a new `Assertion` with the given _obj_.
*
* @param {*} obj
* @api private
*/
var Assertion = should.Assertion = function Assertion(obj) {
this.obj = obj;
};
/**
Way to extend Assertion function. It uses some logic
to define only positive assertions and itself rule with negative assertion.
All actions happen in subcontext and this method take care about negation.
Potentially we can add some more modifiers that does not depends from state of assertion.
*/
Assertion.add = function(name, f, isGetter) {
var prop = {};
prop[isGetter ? 'get' : 'value'] = function() {
var context = new Assertion(this.obj);
context.copy = context.copyIfMissing;
try {
f.apply(context, arguments);
} catch(e) {
//copy data from sub context to this
this.copy(context);
//check for fail
if(e instanceof should.AssertionError) {
//negative fail
if(this.negate) {
this.obj = context.obj;
this.negate = false;
return this;
}
this.assert(false);
}
// throw if it is another exception
throw e;
}
//copy data from sub context to this
this.copy(context);
if(this.negate) {
this.assert(false);
}
this.obj = context.obj;
this.negate = false;
return this;
};
Object.defineProperty(Assertion.prototype, name, prop);
};
Assertion.alias = function(from, to) {
Assertion.prototype[to] = Assertion.prototype[from]
};
should.AssertionError = AssertionError;
var i = should.format = function i(value) {
if(util.isDate(value) && typeof value.inspect !== 'function') return value.toISOString(); //show millis in dates
return inspect(value, { depth: null });
};
should.use = function(f) {
f(this, Assertion);
return this;
};
/**
* Expose should to external world.
*/
exports = module.exports = should;
/**
* Expose api via `Object#should`.
*
* @api public
*/
Object.defineProperty(Object.prototype, 'should', {
set: function(){},
get: function(){
return should(this);
},
configurable: true
});
Assertion.prototype = {
constructor: Assertion,
assert: function(expr) {
if(expr) return;
var params = this.params;
var msg = params.message, generatedMessage = false;
if(!msg) {
msg = this.getMessage();
generatedMessage = true;
}
var err = new AssertionError({
message: msg
, actual: this.obj
, expected: params.expected
, stackStartFunction: this.assert
});
err.showDiff = params.showDiff;
err.operator = params.operator;
err.generatedMessage = generatedMessage;
throw err;
},
getMessage: function() {
return 'expected ' + i(this.obj) + (this.negate ? ' not ': ' ') +
this.params.operator + ('expected' in this.params ? ' ' + i(this.params.expected) : '');
},
copy: function(other) {
this.params = other.params;
},
copyIfMissing: function(other) {
if(!this.params) this.params = other.params;
},
/**
* Negation modifier.
*
* @api public
*/
get not() {
this.negate = !this.negate;
return this;
}
};
+119
View File
@@ -0,0 +1,119 @@
/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/**
* Check if given obj just a primitive type wrapper
* @param {Object} obj
* @returns {boolean}
* @api private
*/
exports.isWrapperType = function(obj) {
return isNumber(obj) || isString(obj) || isBoolean(obj);
};
/**
* Merge object b with object a.
*
* var a = { foo: 'bar' }
* , b = { bar: 'baz' };
*
* utils.merge(a, b);
* // => { foo: 'bar', bar: 'baz' }
*
* @param {Object} a
* @param {Object} b
* @return {Object}
* @api private
*/
exports.merge = function(a, b){
if (a && b) {
for (var key in b) {
a[key] = b[key];
}
}
return a;
};
function isNumber(arg) {
return typeof arg === 'number' || arg instanceof Number;
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string' || arg instanceof String;
}
function isBoolean(arg) {
return typeof arg === 'boolean' || arg instanceof Boolean;
}
exports.isBoolean = isBoolean;
exports.isString = isString;
function isBuffer(arg) {
return typeof Buffer !== 'undefined' && arg instanceof Buffer;
}
exports.isBuffer = isBuffer;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isArguments(object) {
return objectToString(object) === '[object Arguments]';
}
exports.isArguments = isArguments;
exports.isFunction = function(arg) {
return typeof arg === 'function' || arg instanceof Function;
};
function isError(e) {
return isObject(e) && objectToString(e) === '[object Error]';
}
exports.isError = isError;
exports.inspect = require('util').inspect;
exports.AssertionError = require('assert').AssertionError;
var hasOwnProperty = Object.prototype.hasOwnProperty;
exports.forOwn = function(obj, f, context) {
for(var prop in obj) {
if(hasOwnProperty.call(obj, prop)) {
f.call(context, obj[prop], prop);
}
}
};
+38
View File
@@ -0,0 +1,38 @@
{
"name": "should",
"description": "test framework agnostic BDD-style assertions",
"version": "3.1.2",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/should.js.git"
},
"homepage": "https://github.com/visionmedia/should.js",
"scripts": {
"test": "make test"
},
"devDependencies": {
"mocha": "*",
"jsdom": "*",
"jquery": "*"
},
"keywords": [
"test",
"bdd",
"assert"
],
"main": "./lib/node.js",
"engines": {
"node": ">= 0.2.0"
},
"readme": "# should.js\n\n_should_ is an expressive, readable, test framework agnostic, assertion library. Main goals of this library __to be expressive__ and __to be helpful__. It means test code should be clean, and error messages enough helpfull to understand error.\n\nIt extends the `Object.prototype` with a single non-enumerable getter that allows you to express how that object should behave, also it returns itself when required with `require`.\n\n## Example\n```javascript\nvar should = require('should');\n\nvar user = {\n name: 'tj'\n , pets: ['tobi', 'loki', 'jane', 'bandit']\n};\n\nuser.should.have.property('name', 'tj');\nuser.should.have.property('pets').with.lengthOf(4);\n\n// if the object was created with Object.create(null)\n// then it doesn't inherit `Object` and have the `should` getter\n// so you can do:\n\nshould(user).have.property('name', 'tj');\nshould(true).ok;\n\nsomeAsyncTask(foo, function(err, result){\n should.not.exist(err);\n should.exist(result);\n result.bar.should.equal(foo);\n});\n```\n## To begin\n\n 1. Install it:\n \n $ npm install should --save-dev\n \n 2. Require it and use:\n\n```javascript\nvar should = require('should');\n\n(5).should.be.exactly(5).and.be.a.Number;\n```\n\n## In browser\n\nIf you want to use _should_ in browser, use version that is in root of repository (or build it yourself). It is builded with browserify (see [Makefile](https://github.com/visionmedia/should.js/blob/master/Makefile)). To build fresh version:\n\n```bash\n# you should have browserify\nnpm install -g browserify\nmake browser\n```\n\nThis script exported to `window.Should`. It is the same as use `should` statically:\n\n```js\nShould(5).be.exactly(5)\n```\n\nAlso as for node.js case `Object.prototype` extended with `should` (that is why `window.Should` used):\n\n```js\nwindow.should.be.exactly(window);\n// the same\n// window is host object \nshould.be.exactly(window);\n// you should not really care about it\n\n(5).should.be.exactly(5);\n```\n\n*should.js* uses EcmaScript 5 very extensively so any browser that support ES5 is supported. (IE <=8 not supported).\nSee [kangax's compat table](http://kangax.github.io/es5-compat-table) to know which exactly.\n\nYou can easy install it with again npm or bower:\n```\nnpm install should --save-dev\n# or\nbower install visionmedia/should.js\n```\n\n## Static should and assert module\n\nFor some rare cases should can be used statically, without `Object.prototype`.\nIt can be replacement for node assert module:\n\n```javascript\nassert.fail(actual, expected, message, operator) // just write wrong should assertion\nassert(value, message), assert.ok(value, [message]) // should(value).ok\nassert.equal(actual, expected, [message]) // should(actual).eql(expected, [message])\nassert.notEqual(actual, expected, [message]) // should(actual).not.eql(expected, [message])\nassert.deepEqual(actual, expected, [message]) // should(actual).eql(expected, [message])\nassert.notDeepEqual(actual, expected, [message]) // should(actual).not.eql(expected, [message])\nassert.strictEqual(actual, expected, [message]) // should(actual).equal(expected, [message])\nassert.notStrictEqual(actual, expected, [message]) // should(actual).not.equal(expected, [message])\nassert.throws(block, [error], [message]) // should(block).throw([error])\nassert.doesNotThrow(block, [message]) // should(block).not.throw([error])\nassert.ifError(value) // should(value).Error (to check if it is error) or should(value).not.ok (to check that it is falsy)\n```\n\t\n## .not\n\n`.not` negate current assertion.\n\n# Assertions\n## chaining assertions\n\nEvery assertion will return a `should.js`-wrapped Object, so assertions can be chained.\nYou can use this helpers to just chain: `.an`, `.of`, `.a`, `.and`, `.be`, `.have`, `.with`, `.is`, `.which`. Use them for better readability, they do nothing at all.\nFor example:\n```js\nuser.should.be.an.instanceOf(Object).and.have.property('name', 'tj');\nuser.pets.should.be.instanceof(Array).and.have.lengthOf(4);\n```\nAlmost all assertions return the same object - so you can easy chain them. But some move assertion object to property value. See feather, it will be mention if object chainged.\n\n## .ok\n\nAssert if asseted object is truthy in javascript meaning of truthy ('', null, undefined, 0 , NaN, Infinity - is falsy, so all others are truthy).\n\nAssert truthfulness:\n\n```javascript\ntrue.should.be.ok;\n'yay'.should.be.ok;\n(1).should.be.ok;\n({}).should.be.ok;\n```\n\nor negated:\n\n```javascript\nfalse.should.not.be.ok;\n''.should.not.be.ok;\n(0).should.not.be.ok;\n```\n\n## .true\n\nAssert if asseted object === true:\n\n```javascript\ntrue.should.be.true;\n'1'.should.not.be.true;\n```\n\n## .false\n\nAssert if asseted object === false:\n\n```javascript\nfalse.should.be.false;\n(0).should.not.be.false;\n```\n\n## .eql(otherValue)\n\nAssert if asserted object is *equal* to otherValue. This means that object compared by its actual content, nLine truncated
"readmeFilename": "Readme.md",
"bugs": {
"url": "https://github.com/visionmedia/should.js/issues"
},
"_id": "should@3.1.2",
"_from": "should@"
}
+2321
View File
File diff suppressed because it is too large. Load diff
+2321
View File
File diff suppressed because it is too large. Load diff
+55
View File
@@ -0,0 +1,55 @@
!function(C){if("object"==typeof exports)module.exports=C();else if("function"==typeof define&&define.amd)define(C);else{var h;"undefined"!=typeof window?h=window:"undefined"!=typeof global?h=global:"undefined"!=typeof self&&(h=self);h.Should=C()}}(function(){return function h(k,d,g){function l(f,c){if(!d[f]){if(!k[f]){var e="function"==typeof require&&require;if(!c&&e)return e(f,!0);if(a)return a(f,!0);throw Error("Cannot find module '"+f+"'");}e=d[f]={exports:{}};k[f][0].call(e.exports,function(b){var c=
k[f][1][b];return l(c?c:b)},e,e.exports,h,k,d,g)}return d[f].exports}for(var a="function"==typeof require&&require,e=0;e<g.length;e++)l(g[e]);return l}({1:[function(h,k,d){d=h("./should");d.use(h("./ext/assert")).use(h("./ext/chain")).use(h("./ext/bool")).use(h("./ext/number")).use(h("./ext/eql")).use(h("./ext/type")).use(h("./ext/string")).use(h("./ext/property")).use(h("./ext/error")).use(h("./ext/match")).use(h("./ext/browser/jquery")).use(h("./ext/deprecated"));k.exports=d},{"./ext/assert":3,
"./ext/bool":4,"./ext/browser/jquery":5,"./ext/chain":6,"./ext/deprecated":7,"./ext/eql":8,"./ext/error":9,"./ext/match":10,"./ext/number":11,"./ext/property":12,"./ext/string":13,"./ext/type":14,"./should":15}],2:[function(h,k,d){function g(f,c){if(f===c)return!0;if(a.isBuffer(f)&&a.isBuffer(c)){if(f.length!=c.length)return!1;for(var e=0;e<f.length;e++)if(f[e]!==c[e])return!1;return!0}return a.isDate(f)&&a.isDate(c)?f.getTime()===c.getTime():a.isRegExp(f)&&a.isRegExp(c)?f.source===c.source&&f.global===
c.global&&f.multiline===c.multiline&&f.lastIndex===c.lastIndex&&f.ignoreCase===c.ignoreCase:a.isObject(f)||a.isObject(c)?l(f,c):f==c}function l(f,c){if(a.isNullOrUndefined(f)||a.isNullOrUndefined(c)||f.prototype!==c.prototype)return!1;if(a.isArguments(f)){if(!a.isArguments(c))return!1;f=e.call(f);c=e.call(c);return g(f,c)}try{var m=Object.keys(f),b=Object.keys(c),p}catch(d){return!1}if(m.length!=b.length)return!1;m.sort();b.sort();for(p=m.length-1;0<=p;p--)if(m[p]!=b[p])return!1;for(p=m.length-1;0<=
p;p--)if(b=m[p],!g(f[b],c[b]))return!1;return!0}var a=h("./util");k.exports=g;var e=Array.prototype.slice},{"./util":16}],3:[function(h,k,d){var g=h("../util"),l=h("assert"),a=l.AssertionError;k.exports=function(e){var f=e.format;g.merge(e,l);e.exist=e.exists=function(c,g){if(null==c)throw new a({message:g||"expected "+f(c)+" to exist",stackStartFunction:e.exist});};e.not={};e.not.exist=e.not.exists=function(c,g){if(null!=c)throw new a({message:g||"expected "+f(c)+" to not exist",stackStartFunction:e.not.exist});
}}},{"../util":16,assert:17}],4:[function(h,k,d){k.exports=function(g,d){d.add("true",function(){this.is.exactly(!0)},!0);d.add("false",function(){this.is.exactly(!1)},!0);d.add("ok",function(){this.params={operator:"to be truthy"};this.assert(this.obj)},!0)}},{}],5:[function(h,k,d){var g=h("../../util");k.exports=function(d,a){function e(b,a,e,d,m){var h=(g.isObject(d)?Object.keys(d):[d]).reduce(function(a,r){var f=c(this.obj)[b](r);"undefined"!==typeof f&&(a[r]=f);return a}.bind(this),{});4===arguments.length&&
g.isObject(d)?(this.params={operator:"to have "+e+" "+f(d)},h.should.have.properties(d)):4===arguments.length?(this.params={operator:"to have "+a+" "+f(d)},h.should.have.property(d)):(this.params={operator:"to have "+a+" "+f(d)+" with value "+f(m)},h.should.have.property(d,m))}var f=d.format,c=this.jQuery||this.$;"undefined"!==typeof HTMLElement&&HTMLElement&&!HTMLElement.prototype.inspect&&(HTMLElement.prototype.inspect=function(){return this.outerHTML});"undefined"!==typeof jQuery&&jQuery&&!jQuery.prototype.inspect&&
(jQuery.fn.inspect=function(){var b=this.toArray().map(function(b){return g.inspect(b)}).join(", ");return this.selector?"SELECTOR("+this.selector+") matching "+this.length+" elements"+(b.length?": "+b:""):b});var m=function(b,f,e){a.add(f||b,function(){this.params={operator:"to be "+(e||b)};this.assert(c(this.obj).is(":"+b))},!0)};a.add("className",function(b){this.params={operator:"to have class "+b};this.assert(c(this.obj).hasClass(b))});a.add("css",function(b){this.params={operator:"to have css "+
f(b)};for(var a in b){var e=b[a];"auto"===e&&"auto"===c(this.obj).get(0).style[a]||c(this.obj).css(a).should.eql(e)}});m("visible");m("hidden");m("selected");m("checked");m("disabled");m("empty","emptyJq");m("focus","focused","focused");a.add("inDOM",function(){this.params={operator:"to be in the DOM"};this.assert(c.contains(document.documentElement,c(this.obj)[0]))},!0);a.add("exist",function(){this.params={operator:"to exist"};c(this.obj).should.not.have.length(0)},!0);a.add("attr",function(){var b=
["attr","attribute","attributes"].concat(Array.prototype.slice.call(arguments,0));e.apply(this,b)});a.add("prop",function(){var b=["prop","property","properties"].concat(Array.prototype.slice.call(arguments,0));e.apply(this,b)});a.add("elementId",function(b){this.params={operator:"to have ID "+f(b)};this.obj.should.have.attr("id",b)});a.add("html",function(b){this.params={operator:"to have HTML "+f(b)};c(this.obj).html().should.eql(c("<div/>").append(b).html())});a.add("containHtml",function(b){this.params=
{operator:"to contain HTML "+f(b)};c(this.obj).html().indexOf(c("<div/>").append(b).html()).should.be.above(-1)});a.add("text",function(b){this.params={operator:"to have text "+f(b)};var a=c.trim(c(this.obj).text());g.isRegExp(b)?a.should.match(b):a.should.eql(b)});a.add("containText",function(b){this.params={operator:"to contain text "+f(b)};var a=c.trim(c(this.obj).text());g.isRegExp(b)?a.should.match(b):a.indexOf(b).should.be.above(-1)});a.add("value",function(b){this.params={operator:"to have value "+
f(b)};c(this.obj).val().should.eql(b)});a.add("data",function(){var b=["data","data","data"].concat(Array.prototype.slice.call(arguments,0));e.apply(this,b)});a.add("containElement",function(b){this.params={operator:"to contain "+c(b).inspect()};c(this.obj).find(b).should.not.have.length(0)});a.add("matchedBy",function(b){this.params={operator:"to be matched by selector "+b};c(this.obj).filter(b).should.not.have.length(0)});a.add("handle",function(b){this.params={operator:"to handle "+b};var a=c._data(c(this.obj).get(0),
"events");if(!a||!b||"string"!==typeof b)return this.assert(!1);var f=b.split(".");b=f.shift();var e=f.slice(0).sort(),e=RegExp("(^|\\.)"+e.join("\\.(?:.*\\.)?")+"(\\.|$)");if(a[b]&&f.length){for(f=0;f<a[b].length;f++)if(e.test(a[b][f].namespace))return;this.assert(!1)}else a.should.have.property(b),a[b].should.not.have.length(0)});a.add("handleWith",function(b,a){this.params={operator:"to handle "+b+" with "+a};for(var f=b.split(".")[0],f=c._data(c(this.obj).get(0),"events")[f],e=0;e<f.length;e++)if(f[e].handler==
a)return;this.assert(!1)})}},{"../../util":16}],6:[function(h,k,d){k.exports=function(g,d){"an of a and be have with is which".split(" ").forEach(function(a){Object.defineProperty(d.prototype,a,{get:function(){return this}})})}},{}],7:[function(h,k,d){var g=h("../util"),l=h("../eql");k.exports=function(a,e){var f=a.format;e.add("include",function(c,a){if(Array.isArray(this.obj)||g.isString(this.obj))this.params={operator:"to include "+f(c),message:a},this.assert(~this.obj.indexOf(c));else{this.params=
{operator:"to include an object equal to "+f(c),message:a};var b={},e;for(e in c)b[e]=this.obj[e];this.assert(l(b,c))}});e.add("includeEql",function(c,a){this.params={operator:"to include an object equal to "+f(c),message:a};this.assert(this.obj.some(function(b){return l(c,b)}))})}},{"../eql":2,"../util":16}],8:[function(h,k,d){var g=h("../eql");k.exports=function(d,a){a.add("eql",function(a,f){this.params={operator:"to equal",expected:a,showDiff:!0,message:f};this.assert(g(a,this.obj))});a.add("equal",
function(a,f){this.params={operator:"to be",expected:a,showDiff:!0,message:f};this.assert(a===this.obj)});a.alias("equal","exactly")}},{"../eql":2}],9:[function(h,k,d){k.exports=function(g,d){var a=g.format;d.add("throw",function(e){var f=this.obj,c={},g="",b=!0;try{f(),b=!1}catch(d){c=d}b&&("string"==typeof e?b=e==c.message:e instanceof RegExp?b=e.test(c.message):"function"==typeof e&&(b=c instanceof e),e&&!b?"string"==typeof e?g=" with a message matching '"+e+"', but got '"+c.message+"'":e instanceof
RegExp?g=" with a message matching "+e+", but got '"+c.message+"'":"function"==typeof e&&(g=" of type "+e.name+", but got "+c.constructor.name):g=" (got "+a(c)+")");this.params={operator:"to throw exception"+g};this.assert(b)});d.alias("throw","throwError")}},{}],10:[function(h,k,d){var g=h("../util"),l=h("../eql");k.exports=function(a,e){var f=a.format;e.add("match",function(c,d){this.params={operator:"to match "+f(c),message:d};if(!l(this.obj,c))if(g.isRegExp(c))if(g.isString(this.obj))this.assert(c.exec(this.obj));
else if(Array.isArray(this.obj))this.obj.forEach(function(b){this.assert(c.exec(b))},this);else{if(g.isObject(this.obj)){var b=[],p=[];g.forOwn(this.obj,function(a,e){c.exec(a)?p.push(f(e)):b.push(f(e))},this);b.length&&(this.params.operator+="\n\tnot matched properties: "+b.join(", "));p.length&&(this.params.operator+="\n\tmatched properties: "+p.join(", "));this.assert(0==b.length)}}else if(g.isFunction(c)){var h;try{h=c(this.obj)}catch(k){throw k instanceof a.AssertionError&&(this.params.operator+=
"\n\t"+k.message),k;}h instanceof e&&(this.params.operator+="\n\t"+h.getMessage());g.isBoolean(h)&&this.assert(h)}else g.isObject(c)?(b=[],p=[],g.forOwn(c,function(c,f){try{this.obj[f].should.match(c),p.push(f)}catch(e){if(e instanceof a.AssertionError)b.push(f);else throw e;}},this),b.length&&(this.params.operator+="\n\tnot matched properties: "+b.join(", ")),p.length&&(this.params.operator+="\n\tmatched properties: "+p.join(", ")),this.assert(0==b.length)):this.assert(!1)});e.add("matchEach",function(c,
a){this.params={operator:"to match each "+f(c),message:a};var b=c;g.isRegExp(c)?b=function(b){return!!c.exec(b)}:g.isFunction(c)||(b=function(b){return l(b,c)});g.forOwn(this.obj,function(c,a){var f=b(c,a);g.isBoolean(f)&&this.assert(f)},this)})}},{"../eql":2,"../util":16}],11:[function(h,k,d){k.exports=function(g,d){d.add("NaN",function(){this.params={operator:"to be NaN"};this.is.a.Number.and.assert(isNaN(this.obj))},!0);d.add("Infinity",function(){this.params={operator:"to be Infinity"};this.is.a.Number.and.not.a.NaN.and.assert(!isFinite(this.obj))},
!0);d.add("within",function(a,e,f){this.params={operator:"to be within "+a+".."+e,message:f};this.assert(this.obj>=a&&this.obj<=e)});d.add("approximately",function(a,e,f){this.params={operator:"to be approximately "+a+" \u00b1"+e,message:f};this.assert(Math.abs(this.obj-a)<=e)});d.add("above",function(a,e){this.params={operator:"to be above "+a,message:e};this.assert(this.obj>a)});d.add("below",function(a,e){this.params={operator:"to be below "+a,message:e};this.assert(this.obj<a)});d.alias("above",
"greaterThan");d.alias("below","lessThan")}},{}],12:[function(h,k,d){var g=h("../util"),l=h("../eql"),a=Array.prototype.slice;k.exports=function(e,f){var c=e.format;f.add("property",function(b,c){if(1<arguments.length){var a={};a[b]=c;this.have.properties(a)}else this.have.properties(b);this.obj=this.obj[b]});f.add("properties",function(b){var f={};1<arguments.length?b=a.call(arguments):Array.isArray(b)||(g.isString(b)?b=[b]:(f=b,b=Object.keys(b)));var e=Object(this.obj),d=[];b.forEach(function(b){b in
e||d.push(c(b))});var h=d;0===h.length&&(h=b.map(c));var m=(1===h.length?"to have property ":"to have properties ")+h.join(", ");this.params={operator:m};this.assert(0===d.length);m=Object.keys(f);if(m.length){var k=[],h=[];m.forEach(function(b){var a=f[b];l(e[b],a)?h.push(c(b)+" of "+c(a)):k.push(c(b)+" of "+c(a)+" (got "+c(e[b])+")")});0<k.length&&(h=k);m=(1===h.length?"to have property ":"to have properties ")+h.join(", ");this.params={operator:m};this.assert(0===k.length)}});f.add("length",function(b,
c){this.have.property("length",b,c)});f.alias("length","lengthOf");var d=Object.prototype.hasOwnProperty;f.add("ownProperty",function(b,a){this.params={operator:"to have own property "+c(b),message:a};this.assert(d.call(this.obj,b));this.obj=this.obj[b]});f.alias("hasOwnProperty","ownProperty");f.add("empty",function(){this.params={operator:"to be empty"};if(g.isString(this.obj)||Array.isArray(this.obj)||g.isArguments(this.obj))this.have.property("length",0);else{var b=Object(this.obj),c;for(c in b)this.have.not.ownProperty(c)}},
!0);f.add("keys",function(b){1<arguments.length?b=a.call(arguments):1===arguments.length&&g.isString(b)?b=[b]:0===arguments.length&&(b=[]);var f=Object(this.obj),e=[];b.forEach(function(b){d.call(this.obj,b)||e.push(c(b))},this);var h=[];Object.keys(f).forEach(function(a){0>b.indexOf(a)&&h.push(c(a))});this.params={operator:(0===b.length?"to be empty":"to have "+(1===b.length?"key ":"keys "))+b.map(c).join(", ")};0<e.length&&(this.params.operator+="\n\tmissing keys: "+e.join(", "));0<h.length&&(this.params.operator+=
"\n\textra keys: "+h.join(", "));this.assert(0===e.length&&0===h.length)});f.alias("keys","key");f.add("containEql",function(b){this.params={operator:"to contain "+c(b)};var a=this.obj;Array.isArray(a)?this.assert(a.some(function(c){return l(c,b)})):g.isString(a)?this.assert(0<=a.indexOf(String(b))):g.isObject(a)?g.forOwn(b,function(b,c){a[c].should.eql(b)}):this.assert(!1)});f.add("containDeep",function(b){this.params={operator:"to contain "+c(b)};var a=this.obj;if(Array.isArray(a))if(Array.isArray(b)){var f=
0;a.forEach(function(a){try{e(a).not.be.null.and.containDeep(b[f]),f++}catch(c){if(!(c instanceof e.AssertionError))throw c;}});this.assert(f==b.length)}else this.assert(!1);else g.isString(a)?this.assert(0<=a.indexOf(String(b))):g.isObject(a)?g.isObject(b)?g.forOwn(b,function(b,c){e(a[c]).not.be.null.and.containDeep(b)}):this.assert(!1):this.eql(b)})}},{"../eql":2,"../util":16}],13:[function(h,k,d){k.exports=function(d,h){h.add("startWith",function(a,e){this.params={operator:"to start with "+d.format(a),
message:e};this.assert(0===this.obj.indexOf(a))});h.add("endWith",function(a,e){this.params={operator:"to end with "+d.format(a),message:e};this.assert(0<=this.obj.indexOf(a,this.obj.length-a.length))})}},{}],14:[function(h,k,d){var g=h("../util");k.exports=function(d,a){a.add("Number",function(){this.params={operator:"to be a number"};this.assert(g.isNumber(this.obj))},!0);a.add("arguments",function(){this.params={operator:"to be arguments"};this.assert(g.isArguments(this.obj))},!0);a.add("type",
function(a,f){this.params={operator:"to have type "+a,message:f};(typeof this.obj).should.be.exactly(a,f)});a.add("instanceof",function(a,f){this.params={operator:"to be an instance of "+a.name,message:f};this.assert(Object(this.obj)instanceof a)});a.add("Function",function(){this.params={operator:"to be a function"};this.assert(g.isFunction(this.obj))},!0);a.add("Object",function(){this.params={operator:"to be an object"};this.assert(g.isObject(this.obj))},!0);a.add("String",function(){this.params=
{operator:"to be a string"};this.assert(g.isString(this.obj))},!0);a.add("Array",function(){this.params={operator:"to be an array"};this.assert(Array.isArray(this.obj))},!0);a.add("Boolean",function(){this.params={operator:"to be a boolean"};this.assert(g.isBoolean(this.obj))},!0);a.add("Error",function(){this.params={operator:"to be an error"};this.assert(g.isError(this.obj))},!0);a.add("null",function(){this.params={operator:"to be null"};this.assert(null===this.obj)},!0);a.alias("instanceof","instanceOf")}},
{"../util":16}],15:[function(h,k,d){var g=h("./util"),l=g.AssertionError,a=g.inspect,e=function(a){return new f(g.isWrapperType(a)?a.valueOf():a)},f=e.Assertion=function(a){this.obj=a};f.add=function(a,b,c){var d={};d[c?"get":"value"]=function(){var a=new f(this.obj);a.copy=a.copyIfMissing;try{b.apply(a,arguments)}catch(c){this.copy(a);if(c instanceof e.AssertionError){if(this.negate)return this.obj=a.obj,this.negate=!1,this;this.assert(!1)}throw c;}this.copy(a);this.negate&&this.assert(!1);this.obj=
a.obj;this.negate=!1;return this};Object.defineProperty(f.prototype,a,d)};f.alias=function(a,b){f.prototype[b]=f.prototype[a]};e.AssertionError=l;var c=e.format=function(c){return g.isDate(c)&&"function"!==typeof c.inspect?c.toISOString():a(c,{depth:null})};e.use=function(a){a(this,f);return this};k.exports=e;Object.defineProperty(Object.prototype,"should",{set:function(){},get:function(){return e(this)},configurable:!0});f.prototype={constructor:f,assert:function(a){if(!a){a=this.params;var b=a.message,
c=!1;b||(b=this.getMessage(),c=!0);b=new l({message:b,actual:this.obj,expected:a.expected,stackStartFunction:this.assert});b.showDiff=a.showDiff;b.operator=a.operator;b.generatedMessage=c;throw b;}},getMessage:function(){return"expected "+c(this.obj)+(this.negate?" not ":" ")+this.params.operator+("expected"in this.params?" "+c(this.params.expected):"")},copy:function(a){this.params=a.params},copyIfMissing:function(a){this.params||(this.params=a.params)},get not(){this.negate=!this.negate;return this}}},
{"./util":16}],16:[function(h,k,d){function g(a){return"number"===typeof a||a instanceof Number}function l(a){return"string"===typeof a||a instanceof String}function a(a){return"boolean"===typeof a||a instanceof Boolean}function e(a){return"object"===typeof a&&null!==a}d.isWrapperType=function(c){return g(c)||l(c)||a(c)};d.merge=function(a,f){if(a&&f)for(var b in f)a[b]=f[b];return a};d.isNumber=g;d.isBoolean=a;d.isString=l;d.isBuffer=function(a){return"undefined"!==typeof Buffer&&a instanceof Buffer};
d.isDate=function(a){return e(a)&&"[object Date]"===Object.prototype.toString.call(a)};d.isObject=e;d.isRegExp=function(a){return e(a)&&"[object RegExp]"===Object.prototype.toString.call(a)};d.isNullOrUndefined=function(a){return null==a};d.isArguments=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};d.isFunction=function(a){return"function"===typeof a||a instanceof Function};d.isError=function(a){return e(a)&&"[object Error]"===Object.prototype.toString.call(a)};d.inspect=
h("util").inspect;d.AssertionError=h("assert").AssertionError;var f=Object.prototype.hasOwnProperty;d.forOwn=function(a,e,b){for(var d in a)f.call(a,d)&&e.call(b,a[d],d)}},{assert:17,util:20}],17:[function(h,k,d){function g(a,b){return q.isUndefined(b)?""+b:q.isNumber(b)&&(isNaN(b)||!isFinite(b))||q.isFunction(b)||q.isRegExp(b)?b.toString():b}function l(a,b){return q.isString(a)?a.length<b?a:a.slice(0,b):a}function a(a,b,c,f,d){throw new n.AssertionError({message:c,actual:a,expected:b,operator:f,
stackStartFunction:d});}function e(b,c){b||a(b,!0,c,"==",n.ok)}function f(a,b){if(a===b)return!0;if(q.isBuffer(a)&&q.isBuffer(b)){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}return q.isDate(a)&&q.isDate(b)?a.getTime()===b.getTime():q.isRegExp(a)&&q.isRegExp(b)?a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.lastIndex===b.lastIndex&&a.ignoreCase===b.ignoreCase:q.isObject(a)||q.isObject(b)?m(a,b):a==b}function c(a){return"[object Arguments]"==
Object.prototype.toString.call(a)}function m(a,b){if(q.isNullOrUndefined(a)||q.isNullOrUndefined(b)||a.prototype!==b.prototype)return!1;if(c(a)){if(!c(b))return!1;a=s.call(a);b=s.call(b);return f(a,b)}try{var d=t(a),e=t(b),g}catch(h){return!1}if(d.length!=e.length)return!1;d.sort();e.sort();for(g=d.length-1;0<=g;g--)if(d[g]!=e[g])return!1;for(g=d.length-1;0<=g;g--)if(e=d[g],!f(a[e],b[e]))return!1;return!0}function b(a,b){return a&&b?"[object RegExp]"==Object.prototype.toString.call(b)?b.test(a):a instanceof
b||!0===b.call({},a)?!0:!1:!1}function p(c,f,d,e){var g;q.isString(d)&&(e=d,d=null);try{f()}catch(h){g=h}e=(d&&d.name?" ("+d.name+").":".")+(e?" "+e:".");c&&!g&&a(g,d,"Missing expected exception"+e);!c&&b(g,d)&&a(g,d,"Got unwanted exception"+e);if(c&&g&&d&&!b(g,d)||!c&&g)throw g;}var q=h("util/"),s=Array.prototype.slice,v=Object.prototype.hasOwnProperty,n=k.exports=e;n.AssertionError=function(b){this.name="AssertionError";this.actual=b.actual;this.expected=b.expected;this.operator=b.operator;b.message?
(this.message=b.message,this.generatedMessage=!1):(this.message=l(JSON.stringify(this.actual,g),128)+" "+this.operator+" "+l(JSON.stringify(this.expected,g),128),this.generatedMessage=!0);var c=b.stackStartFunction||a;Error.captureStackTrace?Error.captureStackTrace(this,c):(b=Error(),b.stack&&(b=b.stack,c=b.indexOf("\n"+c.name),0<=c&&(c=b.indexOf("\n",c+1),b=b.substring(c+1)),this.stack=b))};q.inherits(n.AssertionError,Error);n.fail=a;n.ok=e;n.equal=function(b,c,f){b!=c&&a(b,c,f,"==",n.equal)};n.notEqual=
function(b,c,f){b==c&&a(b,c,f,"!=",n.notEqual)};n.deepEqual=function(b,c,d){f(b,c)||a(b,c,d,"deepEqual",n.deepEqual)};n.notDeepEqual=function(b,c,d){f(b,c)&&a(b,c,d,"notDeepEqual",n.notDeepEqual)};n.strictEqual=function(b,c,f){b!==c&&a(b,c,f,"===",n.strictEqual)};n.notStrictEqual=function(b,c,f){b===c&&a(b,c,f,"!==",n.notStrictEqual)};n.throws=function(a,b,c){p.apply(this,[!0].concat(s.call(arguments)))};n.doesNotThrow=function(a,b){p.apply(this,[!1].concat(s.call(arguments)))};n.ifError=function(a){if(a)throw a;
};var t=Object.keys||function(a){var b=[],c;for(c in a)v.call(a,c)&&b.push(c);return b}},{"util/":20}],18:[function(h,k,d){k.exports="function"===typeof Object.create?function(d,h){d.super_=h;d.prototype=Object.create(h.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}})}:function(d,h){d.super_=h;var a=function(){};a.prototype=h.prototype;d.prototype=new a;d.prototype.constructor=d}},{}],19:[function(h,k,d){k.exports=function(d){return d&&"object"===typeof d&&"function"===
typeof d.copy&&"function"===typeof d.fill&&"function"===typeof d.readUInt8}},{}],20:[function(h,k,d){function g(b,c){var e={seen:[],stylize:a};3<=arguments.length&&(e.depth=arguments[2]);4<=arguments.length&&(e.colors=arguments[3]);v(c)?e.showHidden=c:c&&d._extend(e,c);r(e.showHidden)&&(e.showHidden=!1);r(e.depth)&&(e.depth=2);r(e.colors)&&(e.colors=!1);r(e.customInspect)&&(e.customInspect=!0);e.colors&&(e.stylize=l);return f(e,b,e.depth)}function l(a,b){var c=g.styles[b];return c?"\u001b["+g.colors[c][0]+
"m"+a+"\u001b["+g.colors[c][1]+"m":a}function a(a,b){return a}function e(a){var b={};a.forEach(function(a,c){b[a]=!0});return b}function f(a,g,h){if(a.customInspect&&g&&y(g.inspect)&&g.inspect!==d.inspect&&(!g.constructor||g.constructor.prototype!==g)){var k=g.inspect(h,a);t(k)||(k=f(a,k,h));return k}if(k=c(a,g))return k;var l=Object.keys(g),n=e(l);a.showHidden&&(l=Object.getOwnPropertyNames(g));if(x(g)&&(0<=l.indexOf("message")||0<=l.indexOf("description")))return m(g);if(0===l.length){if(y(g))return a.stylize("[Function"+
(g.name?": "+g.name:"")+"]","special");if(w(g))return a.stylize(RegExp.prototype.toString.call(g),"regexp");if(D(g))return a.stylize(Date.prototype.toString.call(g),"date");if(x(g))return m(g)}var k="",z=!1,A=["{","}"];s(g)&&(z=!0,A=["[","]"]);y(g)&&(k=" [Function"+(g.name?": "+g.name:"")+"]");w(g)&&(k=" "+RegExp.prototype.toString.call(g));D(g)&&(k=" "+Date.prototype.toUTCString.call(g));x(g)&&(k=" "+m(g));if(0===l.length&&(!z||0==g.length))return A[0]+k+A[1];if(0>h)return w(g)?a.stylize(RegExp.prototype.toString.call(g),
"regexp"):a.stylize("[Object]","special");a.seen.push(g);l=z?b(a,g,h,n,l):l.map(function(b){return p(a,g,h,n,b,z)});a.seen.pop();return q(l,k,A)}function c(a,b){if(r(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}if(n(b))return a.stylize(""+b,"number");if(v(b))return a.stylize(""+b,"boolean");if(null===b)return a.stylize("null","null")}function m(a){return"["+Error.prototype.toString.call(a)+
"]"}function b(a,b,c,d,f){for(var e=[],g=0,h=b.length;g<h;++g)Object.prototype.hasOwnProperty.call(b,String(g))?e.push(p(a,b,c,d,String(g),!0)):e.push("");f.forEach(function(f){f.match(/^\d+$/)||e.push(p(a,b,c,d,f,!0))});return e}function p(a,b,c,d,e,g){var h,k;b=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]};b.get?k=b.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):b.set&&(k=a.stylize("[Setter]","special"));Object.prototype.hasOwnProperty.call(d,e)||(h="["+e+"]");k||
(0>a.seen.indexOf(b.value)?(k=null===c?f(a,b.value,null):f(a,b.value,c-1),-1<k.indexOf("\n")&&(k=g?k.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+k.split("\n").map(function(a){return" "+a}).join("\n"))):k=a.stylize("[Circular]","special"));if(r(h)){if(g&&e.match(/^\d+$/))return k;h=JSON.stringify(""+e);h.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=a.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=a.stylize(h,
"string"))}return h+": "+k}function q(a,b,c){var d=0;return 60<a.reduce(function(a,b){d++;0<=b.indexOf("\n")&&d++;return a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0)?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function s(a){return Array.isArray(a)}function v(a){return"boolean"===typeof a}function n(a){return"number"===typeof a}function t(a){return"string"===typeof a}function r(a){return void 0===a}function w(a){return u(a)&&"[object RegExp]"===Object.prototype.toString.call(a)}
function u(a){return"object"===typeof a&&null!==a}function D(a){return u(a)&&"[object Date]"===Object.prototype.toString.call(a)}function x(a){return u(a)&&("[object Error]"===Object.prototype.toString.call(a)||a instanceof Error)}function y(a){return"function"===typeof a}function E(a){return 10>a?"0"+a.toString(10):a.toString(10)}function G(){var a=new Date,b=[E(a.getHours()),E(a.getMinutes()),E(a.getSeconds())].join(":");return[a.getDate(),H[a.getMonth()],b].join(" ")}var I=/%[sdj%]/g;d.format=
function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(g(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,e=d.length,b=String(a).replace(I,function(a){if("%%"===a)return"%";if(c>=e)return a;switch(a){case "%s":return String(d[c++]);case "%d":return Number(d[c++]);case "%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),f=d[c];c<e;f=d[++c])b=null!==f&&u(f)?b+(" "+g(f)):b+(" "+f);return b};d.deprecate=function(a,b){if(r(global.process))return function(){return d.deprecate(a,
b).apply(this,arguments)};if(!0===process.noDeprecation)return a;var c=!1;return function(){if(!c){if(process.throwDeprecation)throw Error(b);process.traceDeprecation?console.trace(b):console.error(b);c=!0}return a.apply(this,arguments)}};var B={},F;d.debuglog=function(a){r(F)&&(F=process.env.NODE_DEBUG||"");a=a.toUpperCase();if(!B[a])if(RegExp("\\b"+a+"\\b","i").test(F)){var b=process.pid;B[a]=function(){var c=d.format.apply(d,arguments);console.error("%s %d: %s",a,b,c)}}else B[a]=function(){};return B[a]};
d.inspect=g;g.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};g.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};d.isArray=s;d.isBoolean=v;d.isNull=function(a){return null===a};d.isNullOrUndefined=function(a){return null==a};d.isNumber=n;d.isString=t;d.isSymbol=function(a){return"symbol"===
typeof a};d.isUndefined=r;d.isRegExp=w;d.isObject=u;d.isDate=D;d.isError=x;d.isFunction=y;d.isPrimitive=function(a){return null===a||"boolean"===typeof a||"number"===typeof a||"string"===typeof a||"symbol"===typeof a||"undefined"===typeof a};d.isBuffer=h("./support/isBuffer");var H="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");d.log=function(){console.log("%s - %s",G(),d.format.apply(d,arguments))};d.inherits=h("inherits");d._extend=function(a,b){if(!b||!u(b))return a;for(var c=Object.keys(b),
d=c.length;d--;)a[c[d]]=b[c[d]];return a}},{"./support/isBuffer":19,inherits:18}]},{},[1])(1)});